diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/index.ts index ed1ae37e52..103b869b9b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/index.ts @@ -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 diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/localization/components/ui-culture-input/ui-culture-input.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/components/ui-culture-input/ui-culture-input.element.ts index 0b33a2fcf4..23504ea2c7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/localization/components/ui-culture-input/ui-culture-input.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/components/ui-culture-input/ui-culture-input.element.ts @@ -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 { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/localization.model.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/extensions/localization.extension.ts similarity index 89% rename from src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/localization.model.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/localization/extensions/localization.extension.ts index 9f06f37020..31781c3414 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/localization.model.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/extensions/localization.extension.ts @@ -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 `` 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 `` 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; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/localization/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/index.ts index d6ca82fa14..92c9f7f488 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/localization/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/index.ts @@ -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'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/localization/localize.element.test.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/localize.element.test.ts index 79cd162781..ae69b81fd1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/localization/localize.element.test.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/localize.element.test.ts @@ -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', diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/localization/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/manifests.ts index a575191100..dd283f2a9f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/localization/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/manifests.ts @@ -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 = [ { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.test.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.test.ts index 9f211317be..03b59277d5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.test.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.test.ts @@ -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 = { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.ts b/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.ts index a155177661..24ebb1ad55 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/localization/registry/localization.registry.ts @@ -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} 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());