Merge pull request #2360 from umbraco/v15/feature/emm-localization
Extension Manifest Map: localization
This commit is contained in:
@@ -25,7 +25,6 @@ import type { ManifestGlobalContext } from './global-context.model.js';
|
||||
import type { ManifestHeaderApp, ManifestHeaderAppButtonKind } from './header-app.model.js';
|
||||
import type { ManifestHealthCheck } from './health-check.model.js';
|
||||
import type { ManifestIcons } from './icons.model.js';
|
||||
import type { ManifestLocalization } from './localization.model.js';
|
||||
import type { ManifestMenu } from './menu.model.js';
|
||||
import type { ManifestMenuItem, ManifestMenuItemLinkKind, ManifestMenuItemTreeKind } from './menu-item.model.js';
|
||||
import type { ManifestPreviewAppProvider } from './preview-app.model.js';
|
||||
@@ -61,7 +60,6 @@ export type * from './global-context.model.js';
|
||||
export type * from './header-app.model.js';
|
||||
export type * from './health-check.model.js';
|
||||
export type * from './icons.model.js';
|
||||
export type * from './localization.model.js';
|
||||
export type * from './menu-item.model.js';
|
||||
export type * from './menu.model.js';
|
||||
export type * from './mfa-login-provider.model.js';
|
||||
@@ -116,7 +114,6 @@ export type ManifestTypes =
|
||||
| ManifestHealthCheck
|
||||
| ManifestIcons
|
||||
| ManifestItemStore
|
||||
| ManifestLocalization
|
||||
| ManifestMenu
|
||||
| ManifestMenuItem
|
||||
| ManifestMenuItemTreeKind
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ManifestLocalization } from '../../extensions/localization.extension.js';
|
||||
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
|
||||
import { css, html, customElement, query, state, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import type { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UUIFormControlMixin } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import type { ManifestLocalization } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
interface UmbCultureInputOption {
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface MetaLocalization {
|
||||
* The value is used to describe the language of the translations according to the extension system
|
||||
* and it will be set as the `lang` attribute on the `<html>` element.
|
||||
* @see https://en.wikipedia.org/wiki/Language_localisation#Language_tags_and_codes
|
||||
* @examples ["en-us", "en-gb", "da-dk"]
|
||||
* @example ["en-us", "en-gb", "da-dk"]
|
||||
*/
|
||||
culture: string;
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface MetaLocalization {
|
||||
* The value is used to describe the direction of the translations according to the extension system
|
||||
* and it will be set as the `dir` attribute on the `<html>` element. It defaults to `ltr`.
|
||||
* @see https://en.wikipedia.org/wiki/Right-to-left
|
||||
* @examples ["ltr"]
|
||||
* @example ["ltr"]
|
||||
* @default "ltr"
|
||||
*/
|
||||
direction?: 'ltr' | 'rtl';
|
||||
@@ -42,3 +42,9 @@ export interface MetaLocalization {
|
||||
*/
|
||||
localizations?: UmbLocalizationDictionary;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface UmbExtensionManifestMap {
|
||||
UmbLocalizationExtension: ManifestLocalization;
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,5 @@ import './localize-number.element.js';
|
||||
import './localize-relative-time.element.js';
|
||||
|
||||
export * from './registry/localization.registry.js';
|
||||
export type * from './extensions/localization.extension.js';
|
||||
export { UmbUiCultureInputElement } from './components/index.js';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { UmbLocalizeElement } from './localize.element.js';
|
||||
import { aTimeout, elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
||||
import { umbLocalizationRegistry } from '@umbraco-cms/backoffice/localization';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api';
|
||||
import { umbLocalizationRegistry } from './registry/localization.registry.js';
|
||||
|
||||
const english = {
|
||||
type: 'localization',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ManifestLocalization } from '../extension-registry/models/localization.model.js';
|
||||
import type { ManifestLocalization } from './extensions/localization.extension.js';
|
||||
|
||||
export const manifests: Array<ManifestLocalization> = [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UmbLocalizationRegistry } from './localization.registry.js';
|
||||
import { aTimeout, expect } from '@open-wc/testing';
|
||||
import type { ManifestLocalization } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { ManifestLocalization } from '../extensions/localization.extension.js';
|
||||
|
||||
//#region Localizations
|
||||
const english: ManifestLocalization = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { ManifestLocalization } from '../extensions/localization.extension.js';
|
||||
import {
|
||||
type UmbLocalizationSetBase,
|
||||
type UmbLocalizationDictionary,
|
||||
@@ -5,7 +6,7 @@ import {
|
||||
UMB_DEFAULT_LOCALIZATION_CULTURE,
|
||||
} from '@umbraco-cms/backoffice/localization-api';
|
||||
import { umbLocalizationManager } from '@umbraco-cms/backoffice/localization-api';
|
||||
import type { ManifestLocalization, UmbBackofficeExtensionRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { UmbBackofficeExtensionRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbStringState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { combineLatest } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
@@ -37,6 +38,7 @@ export class UmbLocalizationRegistry {
|
||||
|
||||
/**
|
||||
* Get the current registered translations.
|
||||
* @returns {Map<string, UmbLocalizationSetBase>} Returns the registered translations
|
||||
*/
|
||||
get localizations() {
|
||||
return umbLocalizationManager.localizations;
|
||||
@@ -111,7 +113,7 @@ export class UmbLocalizationRegistry {
|
||||
|
||||
/**
|
||||
* Load a language from the extension registry.
|
||||
* @param locale The locale to load.
|
||||
* @param {string} locale The locale to load.
|
||||
*/
|
||||
loadLanguage(locale: string) {
|
||||
this.#currentLanguage.setValue(locale.toLowerCase());
|
||||
|
||||
Reference in New Issue
Block a user