- Now the
$date
,$time
and$number
stores automatically update when the current locale changes.
- Update precompile-intl-runtime, which contains improvements in the algorithm that chooses the best locale from the locale HTTP header of a request.
- Add a funcionality to exclude certain files in the locales folder from being processed. That
exclude
property can be either a regular expression or a function that takes the file name and returns a boolean. This features replaces the reverted feature from beta.1 - Revert change that made that only languages matching
xx
orxx-XX
are processed. Turns out that detecting what is a valid language name is more complex than that.
- Ensure that only the files in the locales folder that match a language name (
xx
orxx-XX
) are processed.
- Ignore any file in the locales folder which name (excluding the extension) does not match ISO locale names. E.g.
en
oren-US
(Although not technically correct,en-us
is also accepted)
- Support template literals when translations are defined in javascript files.
- Adds support for using
scale
in number skeletons. It is compiled at build time to a simple math operation likenumber / 100
.
- Support number skeletons (beta)
- Make 0.9.1 actually work.
- [BUGFIX] Ensure the formatters work when the app is compiled with the immutable flag on and the locale changes
- [FEATURE] Support all i18n-ally file formats for locales – json5 (
.json5
and.json
) and yaml (.yaml
and.yml
) - [FEATURE] Support locales to be defined within
.js
,.ts
, and.mjs
files - [FEATURE] Allow configuring new transformers based on file extension
- [FEATURE] Support loading of locales without an extension (
$locales/en
instead of$locales/en.js
) - [FEATURE] Sort
availableLocales
export of$locales
module that more specific locales come firsten-US
comes beforeen
- [FEATURE] Add
filename
to babel transform for better debugging - [FEATURE] Add typescript definitions for
svelte-intl-precompile/sveltekit-plugin
- [FEATURE] Add
exports
field topackage.json
with legacy./sveltekit-plugin.js
and./sveltekit-plugin.cjs
exports - [BUGFIX] Invalidate
$locales
module in HMR mode if a file within the locales directory has changed - [BUGFIX] Normalize paths when determining if a file is within the locales directory
- [BUGFIX] Add
index.cjs
to re-exportprecompile-intl-runtime
for cjs compat loading - [BUILD] Autogenerate
./sveltekit-plugin.cjs
from./sveltekit-plugin.js
during publishing
- [FEATURE] expose the
prefix
(default:$locales
) as a module that allows to register (registerAll()
) and access (availableLocales
) all available translations.
- [BUGFIX] Update babel pluging to fix a bug with translations that only contain a single date/time helper and no other text.
- [BUGFIX] Fix bug with exact plurals having two or more digits. E.g
=12 {a docen cats}
.
- Updates the babel plugin which in turn now depends on the new
@formatjs/icu-message-parser
package, which replaces the now unmaintainedintl-message-parser
. It is supposed to be compatible although I've identified one corner case where some previously supported feature (nested plurals) are now not supported anymore. Opened formatjs/formatjs#3250 to fix this.
- Updates the babel pluging that precompiles ICU strings. Should be backwards compatible, but it's risky enough to grant a minor version bump.
- Export internal
transformCode(str)
function to create interactive playground.
- [FEATURE] Supports defining translations in plain json files. This makes much easier to integrate this library with i18n flows like Lokalise. In reality this
has always been the goal and having to define translations in JS/TS files was just a workaround while figuring out how it works.
Now if your translations are defined in
/locales/en.json
you can import it from$locales/en.js
and svelte will know what to do.
- Reexport type definitions so typescript detects types properly.
- Bump
babel-plugin-precompile-intl
to fix bug when ICU string start with an expression but end with something else.
- Update
precompile-intl-runtime
to 0.4.2 which allows for thegetLocaleFromNavigator
function to receive an optional parameter that is the value to return when SSR'ing.
- Add two versions of the SvelteKit plugin: One in ES6 module syntax ending in
.js
and one in commonJS ending in.cjs
.