How svelte-intl-precompile works
mainUnlike traditional i18n libraries that parse ICU message syntax in the browser, svelte-intl-precompile acts as a compiler for your translations.
During the build step, a Babel plugin analyzes your ICU strings (e.g., {count, plural, ...}) and transforms them into highly optimized JavaScript functions. These functions use a tiny, tree-shakable runtime (precompile-intl-runtime) that leverages the native browser Intl API.
Benefits:
- Smaller Bundle Size: Typically adds < 2kb to your final build, compared to ~15kb for runtime parsers.
- Faster Performance: Up to 25% faster for repeated renders and up to 400% faster for initial renders of new keys.