/utils/languageTemplates

The languageTemplates module requests templates that maybe localised.

A localised template object will have properties matching a language code. The property value being the localised template for that language.

token_not_found: {
  en: `Token not found. The token has probably been resolved already.`,
  fr: `Token n’a pas été trouvé. Il a probablement déjà été utilisé.`,
  pl: `Token wygasł. Prawdopodobnie został już wykorzystany.`,
  ja: `トークンが見つかりません。 トークンはおそらくすでに解決されています。`,
  ko: `토근이 발견되지 않았습니다. 이미 해결된 것 같습니다.`,
  zh: `未找到相关令牌, 该令牌可能已解析`
}

English being the default language, each language template should have the 'en' property.

Requires

Methods

(async, inner) languageTemplates(params) → {Promise}

The method will request a template from the getTemplate() module method.

The params.template string will be returned if the getTemplate method returns an error. A message template may not exist and the template reference should be returned to the requesting method rather than an error message stating that the template doesn't exist.

A [view] template which is not a languageTemplate maybe requested from the View API module. The object returned from the getTemplate method will have a template string property which will be returned to the caller.

Valid language template objects must have an en property. The english template will be returned if the requested language is not a property of the template object.

Parameters:
NameTypeDescription
paramsObject

Params object which specifies the template.

Properties
NameTypeAttributesDefaultDescription
params.templatestring

The key of the template.

params.languagestring<optional>
'en'

The template language

Returns:

The promise will resolve to a string or object.

Type: 
Promise