- UI application should be as fast as possible therefore it should store as less translations as possible.
Contents
Formats[edit]
What is Key[edit]
in Angular #xlif Key is 'custom id'+'meaning|description'. And it is very good that result sources do not contain keys making them smaller
in #dotNet Key is 'English text' therefore in order to simulate "'English text'+'meaning'" pattern the suffix _<meaning> should be added:
- no suffix - action as several words or noun
- _a - action, verb as causative sentence
JS[edit]
xlif[edit]
- Angular natively understands .xlf, .xlif and .xtb formats. Angular natively does not allow language change without app refresh, moretheover in AOT You need to build and deploy a separate version of the application for each supported language.
- Internationalization with the AOT compiler is faster
- problem: After an id changes, the translation files are no longer in-sync. All translated versions of the application will fail during re-compilation. The error messages identify the old ids that are no longer valid but they don't tell you what the new ids should be.
Json[edit]
composed key[edit]
{
"HOME": {
"TITLE": "Angular 2 Localization",
...
}
}
parameters[edit]
{
"USER_NOTIFICATIONS": "{{ user }}, you have {{ NoMessages }} new messages",
...
}
what ready module to use?[edit]
- !!! Angular i18n
- !!! angular-l10n
- Angular2 and webpack - i18n plugin vs ng2-translate
dotNet[edit]
- resource assemblies with ResXFileCodeGeneratorEx
- Resharper Internationalization
- https://github.com/tom-englert/ResXResourceManager show all ResX based resources in the solution and can auto-translate
conversion from #dotNet format[edit]
to xlif by MAT[edit]
to #xlif by Category:Localization tools#MAT
- in Visual studio right-click <file>.resx and select main menu Tools/MAT/Enable selection
- right-click <file>.resx and select context menu MAT/Add transl. language
- xlf-file will be in MultilingualResources folder
Where to store English texts[edit]
English texts and messages keys are not stored in a xlf-compiled Angular application, but only in developer sources.
#dotNet resources store messages keys and are not memory efficient.
Get language for localization[edit]
in JS[edit]
browser language... navigator.language || navigator.userLanguage
HTTP 'Accept-Language' header, but it appears this value is not available through javascript at all.
Deployment view[edit]
Subcategories
This category has the following 2 subcategories, out of 2 total.
Pages in category "Localization"
The following 2 pages are in this category, out of 2 total.