use dash (-) instead of underscore (_) for backward compatibility

This commit is contained in:
Jacob Overgaard
2023-07-27 15:44:06 +02:00
parent 5345cfbe48
commit c680a30c45
6 changed files with 10 additions and 10 deletions

View File

@@ -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);
}
});

View File

@@ -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);

View File

@@ -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();

View File

@@ -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'),
},
];

View File

@@ -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",