v0.6.0 #269
Baptistemontan
announced in
Announcements
v0.6.0
#269
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
v0.6.0
I'm glad to announce the release of the long awaited
v0.6.0.This release add the support for leptos
v0.8.xbut also brings a lot of changes, this release note will list them but for more details take alook at the updated book.Codegen rework
In older versions the codegen was done by the
load_locales!()macro, worked fine but a couple of issues came with it, so it is now deprecated and users are recommanded to migrate to the new codegen:leptos_i18n_build.Initially made for datagen of
ICU4Xdatas, it is now also use to generate thei18nmodule in build scripts.Here a basic setup:
New fallback resolution
If a locale is'nt the default and have no base locale, now find a "less specific" locale for missing keys.
For exemple "fr-FR" will inherit missing keys from "fr" even if "en" is the default.
You can overwrite this behavior by explicitly setting the base locale to the default one.
Deprecated ranges
Coming with v0.6.0, ranges are now deprecacted, users must migrate to plurals.
TOML support
Self explanatory, you can write translations in TOML. (thanks @sabify)
Self-closed components
You can now now interpolate components with no children:
{ "key": "before<br/>after" }Or
(thanks @sabify)
Custom formatters
You can inject parsers for formatters to the translations parser for custom value formatters, see the appendix for it in the book.
Component attributes in translations
You can now declare component attributes directly in the translations:
{ "key": "before<b id={{ id }} foo=\"bar\">middle</b>after" }Or
How to migrate from
v0.5A project coming from
v0.5.11will get errors for unknown features, and deprecations warnings for theload_locales!macro and ranges (if you use them).To fix all that, simply add
leptos_i18n_buildas a dev dependency and create abuild.rsfile at the root of the package, and paste this code:And replace the
load_locales!()byNow to migrate the config ("[package.metadata.leptos-i18n]") with the
Configbuilder:So now you can remove the "[package.metadata.leptos-i18n]" part from your
Cargo.toml.Now the last errors: unknown features:
translations_infos.rerun_if_locales_changed();)You can simply enable them (appart from
track_locale_files) with theParseOptionsbuilder:And you should be good to go !
Special thanks for @sabify for the amazing work!
What's Changed
leptos 0.8.0by @sabify in chore: upgrade toleptos 0.8.0#219load_localesmacro by @Baptistemontan in Deprecateload_localesmacro #2282.0.0-beta*to2.0.0by @sabify in docs: updated icu4x2.0.0-beta*to2.0.0#236emit_diagnosticsfor all examples and test suits by @Baptistemontan in addemit_diagnosticsfor all examples and test suits #263New Contributors
Full Changelog: v0.5.11...v0.6.0
This discussion was created from the release v0.6.0.
Beta Was this translation helpful? Give feedback.
All reactions