Releases: sveltekit-i18n/lib
2.1.3
Updated @sveltekit-i18n/base to version 1.1.2
:
- Fixed non-standard
locale
handling
Full Changelog: 2.1.2...2.1.3
2.1.2
Updated @sveltekit-i18n/parser-default to version 1.0.3
:
- Fixed
date
modifier
Full Changelog: 2.1.1...2.1.2
2.1.1
2.1.0
2.0.0
This major version provides the biggest changes under the hood. sveltekit-i18n library has been split into two – @sveltekit-i18n/base and @sveltekit-i18n/parser-default. This gives you more flexibility to use any message syntax you want by just including according parser.
However, this does not mean you have to start using @sveltekit-i18n/base and @sveltekit-i18n/parser-default libraries directly – you can keep using sveltekit-i18n if you like the default parser. From now, sveltekit-i18n automatically encapsulates the @sveltekit-i18n/base and @sveltekit-i18n/parser-default for you.
There is one change in sveltekit-i18n API, though. config.customModifiers
is now config.parserOptions.customModifiers
, so you should move your customModifiers
under parserOptions
object in your configuration. Besides that, no other changes in this release should affect your implementation.
config.customModifiers
is nowconfig.parserOptions.customModifiers
- Added
config.parserOptions.modifierDefaults
to globally define default properties for built-in modifiers - Added modifier
props
–$('your.translation', { payload: 'value' }, { modifier: 'props' })
so you can easily change properties of modifier directly from your.svelte
files. This overridesconfig.parserOptions.modifierDefaults
. - Added
config.cache
for cache management. - Improved built-in modifiers
- Added CommonJS support (useful for testing for example)
- Improved TS support
- Fixed concurrent loading (#32)
- Improved performance
Full Changelog: 1.5.4...2.0.0
1.5.4
- Fixed locale propagation to modifiers when used with
$l(locale, ... )
(originally,$locale
was propagated instead of the given one) - Refactored source
Full Changelog: 1.5.3...1.5.4
1.5.3
What's Changed
- Added dynamic
default
(defaults from translation payload) by @jarda-svoboda in #25
For example:
$t('common.placeholder_unknown', { default: 'DYNAMIC_DEFAULT_VALUE' });
Also another translation (or variable) can be used as default:
$t(`error.${code}`, { default: $t('error.default') });
Full Changelog: 1.5.2...1.5.3
1.5.2
What's Changed
- Improved
loaders
error handling by @jarda-svoboda in #24
Full Changelog: 1.5.1...1.5.2
1.5.1
What's Changed
- Added
locale-router
andlocale-router-static
examples by @jarda-svoboda in #22 - Updated README by @jarda-svoboda in #23
Full Changelog: 1.5.0...1.5.1
1.5.0
What's Changed
-
Added
get
method to$translations
and$locale
stores -
Added
config.translations
for synchronous sources -
Fixed translation key glitch when switching locales
-
Replaced
initLocale
bysetLocale
method. From now, you should prevent unwanted locale change (to default) while navigating like so:
<script context="module">
import { locale, loadTranslations } from '$lib/translations';
export const load = async ({ url }) => {
const { pathname } = url;
const defaultLocale = 'en';
const initLocale = locale.get() || defaultLocale; // set default only if no locale already set
await loadTranslations(initLocale, pathname);
return {};
}
</script>
Full Changelog: 1.4.0...1.5.0