Skip to content

@salesforce/b2c-tooling-sdk / i18n / getI18nInstance

Function: getI18nInstance()

getI18nInstance(): i18n

Defined in: packages/b2c-tooling-sdk/src/i18n/index.ts:237

Get the i18next instance for advanced usage.

Use this to:

  • Add translations from other packages (e.g., b2c-cli adding 'cli' namespace)
  • Add additional languages at runtime

Returns

i18n

Examples

ts
// Add a new namespace from b2c-cli
getI18nInstance().addResourceBundle('de', 'cli', {
  command: {
    sites: { description: 'Sites-Befehle' }
  }
})
ts
// Add a new language
getI18nInstance().addResourceBundle('fr', 'b2c', {
  error: {
    serverRequired: 'Le serveur est requis.'
  }
})

All rights reserved.