Repository navigation
Releases: bcc-code/bcc-i18n-source-generation
Releases · bcc-code/bcc-i18n-source-generation
Release list
v1.2.0
The generated types now default to the project's RootNamespace. See the manual and the README.
Changes
- Breaking: generated types default to
RootNamespace. WhenGeneratedNamespaceis not set, the types are generated in the project'sRootNamespace. In 1.1.0 and earlier they were generated in the global namespace with the NuGet package, because the props file readRootNamespacebefore the project set it. Code that refers to the types from another namespace needsusing <RootNamespace>;, or setGeneratedNamespaceto keep a specific namespace. Projects that setGeneratedNamespaceare unaffected. - Invalid characters in the default namespace are replaced. The SDK default
RootNamespaceis the project name, so a project namedMy-Appgets the namespaceMy_App. An explicitGeneratedNamespaceis used as written. - User manual. The documentation is now a manual with tutorials, how-to guides, reference and explanation pages.
Pull requests
- docs: add user manual (Diátaxis) in #18
- fix: default the generated namespace to RootNamespace in #19
Full Changelog: v1.1.0...v1.2.0
v1.1.0
The generator no longer depends on System.Text.Json. See the README for documentation.
Changes
- No System.Text.Json dependency. Translation files are read by a small built-in JSON reader. The package now contains only the generator, the props files and the README. Earlier packages shipped System.Text.Json with only some of its dependencies, which could fail to load in compilers hosted on .NET Framework (Visual Studio).
- Diagnostics point at the error. I18N001 (invalid JSON) is reported at the exact position, with line and column in the message. I18N003 (unsupported value) is reported on the property name.
- Lone surrogates are reported. A lone surrogate in a translation file, escaped (
"\uD83D") or raw, now gives I18N001. Before, an escaped one crashed the generator. - Fix: line separators and control characters in values. U+0085, U+2028, U+2029 and other control characters are now escaped in generated code. In 1.0.0, a U+2028 in a value broke the build with CS1010.
The JSON rules are unchanged: no comments, no trailing commas, a single root object, depth up to 64. I18N001 messages have new wording.
Pull requests
- Replace System.Text.Json with a built-in JSON reader in #12
Full Changelog: v1.0.0...v1.1.0
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
v0.2.0
What's Changed
- use trusted publishing by @jkbcz in #1
- chore: add CODEOWNERS by @akselkvitberg in #2
- deps: update packages and GitHub Actions by @akselkvitberg in #3
- ci: test before publishing, add package metadata, license and releases by @akselkvitberg in #8
- feat: support pluralization in a subset of languages by @akselkvitberg in #4
- refactor: improve generator incrementality and generated code hygiene by @akselkvitberg in #5
- feat: make LanguageStrings hot-reload friendly by @akselkvitberg in #6
- feat: opt in translation files with I18NTranslation metadata by @akselkvitberg in #9
- docs: correct README before release by @akselkvitberg in #10
New Contributors
- @jkbcz made their first contribution in #1
- @akselkvitberg made their first contribution in #2
Full Changelog: v0.1.0...v0.2.0