Add localization keys and use them in elements or controllers. Use when adding user-facing text that should be translatable — labels, descriptions, error messages, button text, status text, or any string shown in the backoffice UI.
Add translatable text to the Umbraco backoffice.
actions, general, content, user)File: src/assets/lang/en.ts
This file exports a UmbLocalizationDictionary — a nested object where top-level keys are groups and nested keys are the terms.
// src/assets/lang/en.ts
export default {
// ... existing groups
myFeature: {
myLabel: 'My Label',
myDescription: 'A description of the feature',
createFor: (name: string) => (name ? `Create item for ${name}` : 'Create'),
},
} satisfies UmbLocalizationDictionary;
actions, general, content, media, user)assignDomain, auditTrail, browse)group_termName (underscore separator)| Type | Use when | Example |
|---|---|---|
string | Static text | myLabel: 'My Label' |
(args) => string | Text with dynamic values | createFor: (name: string) => \Create ${name}`` |
this.localize.term()Available on any class extending UmbLitElement. The localize property is provided automatically.
import { customElement, html } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@customElement('umb-my-element')
export class UmbMyElement extends UmbLitElement {
override render() {
return html`
<uui-button label=${this.localize.term('myFeature_myLabel')}></uui-button>
`;
}
}
<umb-localize> elementFor inline localized text in HTML templates:
<umb-localize key="myFeature_myLabel"></umb-localize>
<!-- With fallback text (shown if key is missing) -->
<umb-localize key="myFeature_myLabel">Fallback text</umb-localize>
UmbLocalizationControllerimport { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api';
export class UmbMyManager extends UmbControllerBase {
readonly #localization = new UmbLocalizationController(this);
someMethod() {
const label = this.#localization.term('myFeature_myLabel');
}
}
src/assets/lang/en.ts in the correct groupgroup_termName convention (camelCase, underscore separator)this.localize.term() in elements or UmbLocalizationController in non-elementsnpm run compile