Plugin internationalisation

Because each plugin has to be individually internationalised, locales and other translation APIs start with obtaining a Locale from your Plugin.

Interface

property defaultLocaleId

The ID of the default locale for this plugin, for example, "en".

function locale(localeId)

Returns a Locale object for this plugin.

localeId is optional, and if not specified, the current locale is returned. This is the locale for the current user’s session.

In general, you should not pass in a localeId, as in almost all cases, you need a Locale object to translate the UI for the current user.

Example

To obtain a Locale object, you would almost always use code like:

  let locale = P.locale();