Localization
A class for managing internationalization (translations) in the editor.
I18N
A class for managing translations.
I18N Methods
| Function | Signature | Description |
|---|---|---|
| getLocale | getLocale(): string | Returns the current active locale. |
| getDefaultLocale | getDefaultLocale(): string | Returns the default locale. |
| get | get(key: string, def?: string): string | Returns the translation for the specified key. If the translation is not found, returns the default value. |
Types and Interfaces of I18N
typescript
/**
* Structure of locale map data.
* Key-value pairs for translation strings.
*/
export type LocaleMapData = {
[key: string]: unknown;
};
/**
* Interface for locale map.
* @property code - Locale identifier code
* @property data - Translation data for this locale
*/
export interface LocaleMap {
code: string;
data: LocaleMapData;
}
/**
* Interface for I18N to manage internationalization.
*/
export interface I18N {
getLocale(): string;
getDefaultLocale(): string;
get(key: string, def?: string): string;
}