Class clove::I18N

class clove::I18N

Internationalization support class.

Always use the instance clove.i18n. Read the Manual for details.

Public Functions

addString(id, texts)

Adds a text to the internationalization text table.

The keys are ISO 639-1 language codes.

Example: `addString(‘PleaseWait’, {‘de’:’Bitte warten’, ‘en’:’Please wait’})`

Parameters
  • id: The text identifier name, like ‘FooBar’.

  • texts: A configuration object which holds a text representation for all target languages.

setLanguage(langcode)

Sets the current language.

You don’t need to call this function, unless you want to override the user’s language as it is configured in the operating system or browser.

Parameters
  • langcode: The new current language (as ISO 639-1 language code).

static parseLangCode(lang)

Returns a clove string representation.

Only indended to be used by the infrastructure.

Parameters
  • lang: A language code string as understood by addString().