Repository navigation
v1.0.0
First stable release. See the README for full documentation.
Upgrading from 0.x
These changes can affect existing projects:
- Norwegian users get Norwegian. Languages are now matched through the culture and its parents, plus aliases, instead of
TwoLetterISOLanguageName.nb-NO,nb,nn-NOandnnnow useno.json; before, they silently got the fallback language. Region files such aspt-br.jsonalso match. Configure extra aliases withI18NLanguageAliases(e.g.nb=no;nn=no). - Two-form plurals are fixed.
"car | cars"now follows vue-i18n:car(1)returns "car", every other count returns "cars". Before,car(1)returned "cars". Three-form messages are unchanged; negative counts now use the absolute value. LanguageStringsfalls back per key.GetString/GetStringOrNullreturn the fallback language's text when the current language lacks a key, likeLanguagealready did.- Linked messages are resolved. Text such as
@:common.saveis replaced with the target message in all generated APIs. - New warnings may appear on existing translation files: I18N007 (key missing from a language), I18N008 (key not in the fallback language), I18N009 (invalid language alias), I18N010 (invalid linked message). They are reported on the JSON files, so set their severity in a
.globalconfigor withNoWarn, not in.editorconfigsections. - New generated types
LocalizedLanguage,LocalizedLanguageGroupsand the internalLanguageTranslationsare added next toLanguage. If your project already has types with these names in the generated namespace, rename them or setGeneratedNamespace.
New features
- Explicit culture:
new LocalizedLanguage(culture).message.hello,LanguageStrings.GetString(key, culture), for background jobs, emails and tests without changing the thread culture. - Format specifiers in placeholders:
{date:d},{amount:N2}, formatted with the culture. These are .NET-only; vue-i18n does not understand them. - vue-i18n message syntax: linked messages (
@:key,@:{'key'},@.lower:,@.upper:,@.capitalize:), literals ({'|'},{'@'}, with escapes), list placeholders ({0}). - Listings:
LanguageStrings.FallbackLanguage,Languages,Keys,GetAllStrings(...). - Formatting by key:
LanguageStrings.Format(key, args)with the same parameter order as the generatedLanguagemember. IStringLocalizersupport: when the project references Microsoft.Extensions.Localization.Abstractions,LanguageStringLocalizerandLanguageStringLocalizerFactoryare generated, soIStringLocalizer<T>and validation messages can use the translation files.- The package's release notes on nuget.org now link to the GitHub release.
Pull requests
- feat: warn about keys missing from a language in #11
- feat: match cultures to translation files with language aliases in #13
- feat: explicit culture API and format specifiers in #14
- feat: vue-i18n message syntax and plural rules in #15
- feat: list languages and keys, format by key, IStringLocalizer support in #16
- chore: link package release notes to the GitHub release in #17
Full Changelog: v0.2.0...v1.0.0