use dash (-) instead of underscore (_) for backward compatibility
This commit is contained in:
@@ -46,7 +46,7 @@ export class UmbBackofficeElement extends UmbLitElement {
|
||||
this.consumeContext(UMB_AUTH, (auth) => {
|
||||
this.observe(auth.currentUser, (user) => {
|
||||
if (user) {
|
||||
const languageIsoCode = user.languageIsoCode ?? 'en_us';
|
||||
const languageIsoCode = user.languageIsoCode ?? 'en-us';
|
||||
localizationContext.setLanguage(languageIsoCode);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,8 +18,8 @@ export class UmbLocalizationContext {
|
||||
* Set a new language which will query the manifests for translations and register them.
|
||||
* Eventually it will update all codes visible on the screen.
|
||||
*
|
||||
* @param languageIsoCode The language to use (example: 'en_us')
|
||||
* @param fallbackLanguageIsoCode The fallback language to use (example: 'en_us', default: 'en_us')
|
||||
* @param languageIsoCode The language to use (example: 'en-us')
|
||||
* @param fallbackLanguageIsoCode The fallback language to use (example: 'en-us', default: 'en-us')
|
||||
*/
|
||||
setLanguage(languageIsoCode: string, fallbackLanguageIsoCode?: string) {
|
||||
this.#translationRegistry.register(languageIsoCode, fallbackLanguageIsoCode);
|
||||
|
||||
@@ -18,7 +18,7 @@ export class UmbTranslationRegistry {
|
||||
return this.#innerDictionary.asObservable();
|
||||
}
|
||||
|
||||
register(userCulture: string, fallbackCulture = 'en_us') {
|
||||
register(userCulture: string, fallbackCulture = 'en-us') {
|
||||
userCulture = userCulture.toLowerCase();
|
||||
fallbackCulture = fallbackCulture.toLowerCase();
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ const translationManifests: Array<ManifestTranslations> = [
|
||||
type: 'translations',
|
||||
alias: 'Umb.Translations.En_US',
|
||||
weight: -100,
|
||||
name: 'English (UK)',
|
||||
name: 'English (US)',
|
||||
meta: {
|
||||
culture: 'en_us',
|
||||
culture: 'en-us',
|
||||
},
|
||||
loader: () => import('../../../assets/lang/en_us.js')
|
||||
loader: () => import('../../../assets/lang/en-us.js'),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ The manifest can be added through the `umbraco-package.json` file like this:
|
||||
"alias": "MyPackage.Lang.EnUS",
|
||||
"name": "English (United States)",
|
||||
"meta": {
|
||||
"culture": "en_us"
|
||||
"culture": "en-us"
|
||||
},
|
||||
"js": "/App_Plugins/MyPackage/lang/en_us.js"
|
||||
"js": "/App_Plugins/MyPackage/lang/en-us.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -36,7 +36,7 @@ If you do not have many translations, you can also choose to include them direct
|
||||
|
||||
```json
|
||||
"meta": {
|
||||
"culture": "en_us",
|
||||
"culture": "en-us",
|
||||
"translations": {
|
||||
"section": {
|
||||
"key1": "value1",
|
||||
|
||||
Reference in New Issue
Block a user