A framework-agnostic i18n registry with vue-i18n-like API names.

Key methods:

  • getLocaleMessages(): returns all messages (for vue-i18n { messages })
  • getLocaleMessage(locale): returns single locale messages
  • setLocaleMessage(locale, messages): replace locale messages
  • mergeLocaleMessage(locale, messages): deep-merge into existing locale (fixed)
  • t(locale, key, options): translation helper for core code (no Vue required)

Constructors

Properties

events: { localeChanged: AcCmEventManager<AcApLocaleChangedEventArgs> } = ...

Supported events

Type declaration

  • localeChanged: AcCmEventManager<AcApLocaleChangedEventArgs>

    Fired when locale changed

Accessors

Methods

  • Get localized command description

    Parameters

    • groupName: string

      Command group name

    • cmdName: string

      Global command name

    Returns string

    • The localized command description.
  • Set the current active locale for translation.

    Parameters

    • locale: AcApLocale

      Locale to activate ("en" or "zh")

    Returns void

    This method updates the internal locale state used by all future calls to t(key, options). After calling this method, the entire application will use the new locale automatically.

    AcApI18n.setCurrentLocale('zh')
    console.log(AcApI18n.t('core.start')) // uses Chinese messages
  • Translate a dotted key path using the registry (no Vue required).

    Parameters

    • key: string

      dotted path, e.g. "core.start" or "pluginX.button.ok"

    • Optionaloptions: AcApTranslateOptions

      optional fallback

    Returns string

    translated string or fallback/key if not found