register fallback language
This commit is contained in:
@@ -58,7 +58,7 @@ describe('Localization', () => {
|
||||
registry = new UmbTranslationRegistry(extensionRegistry);
|
||||
extensionRegistry.register(english);
|
||||
extensionRegistry.register(danish);
|
||||
registry.register(english.meta.culture);
|
||||
registry.register(english.meta.culture, english.meta.culture);
|
||||
});
|
||||
|
||||
describe('UmbTranslationRegistry', () => {
|
||||
@@ -75,7 +75,7 @@ describe('Localization', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
context = new UmbLocalizationContext(extensionRegistry);
|
||||
context.setLanguage(english.meta.culture);
|
||||
context.setLanguage(english.meta.culture, english.meta.culture);
|
||||
});
|
||||
|
||||
describe('localize', () => {
|
||||
@@ -108,7 +108,7 @@ describe('Localization', () => {
|
||||
const value = await firstValueFrom(context.localize('general_close'));
|
||||
expect(value).to.equal('Close');
|
||||
|
||||
context.setLanguage(danish.meta.culture);
|
||||
context.setLanguage(danish.meta.culture, english.meta.culture);
|
||||
|
||||
await aTimeout(0);
|
||||
|
||||
@@ -120,7 +120,7 @@ describe('Localization', () => {
|
||||
const value = await firstValueFrom(context.localize('general_logout'));
|
||||
expect(value).to.equal('Log out');
|
||||
|
||||
context.setLanguage(danish.meta.culture);
|
||||
context.setLanguage(danish.meta.culture, english.meta.culture);
|
||||
|
||||
await aTimeout(0);
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('Localization', () => {
|
||||
expect(values[0]).to.equal('Close');
|
||||
expect(values[1]).to.equal('Log out');
|
||||
|
||||
context.setLanguage(danish.meta.culture);
|
||||
context.setLanguage(danish.meta.culture, english.meta.culture);
|
||||
|
||||
await aTimeout(0);
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { aTimeout, elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
||||
import { UmbLocalizeElement } from './localize.element.js';
|
||||
import {
|
||||
UMB_LOCALIZATION_CONTEXT,
|
||||
UmbLocalizationContext,
|
||||
UmbTranslationRegistry,
|
||||
} from '@umbraco-cms/backoffice/localization-api';
|
||||
import { UMB_LOCALIZATION_CONTEXT, UmbLocalizationContext } from '@umbraco-cms/backoffice/localization-api';
|
||||
import { UmbExtensionRegistry } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
import '@umbraco-cms/backoffice/context-api';
|
||||
@@ -58,10 +54,8 @@ describe('umb-localize', () => {
|
||||
extensionRegistry = new UmbExtensionRegistry();
|
||||
extensionRegistry.register(english);
|
||||
extensionRegistry.register(danish);
|
||||
const registry = new UmbTranslationRegistry(extensionRegistry);
|
||||
registry.register(english.meta.culture);
|
||||
context = new UmbLocalizationContext(extensionRegistry);
|
||||
context.setLanguage(english.meta.culture);
|
||||
context.setLanguage(english.meta.culture, english.meta.culture);
|
||||
hostElement = await fixture(
|
||||
html`<umb-context-provider .key=${UMB_LOCALIZATION_CONTEXT} .value=${context}>
|
||||
<umb-localize key="general_close"></umb-localize>
|
||||
|
||||
Reference in New Issue
Block a user