/workspace/getLocale

The getLocale module exports the getLocale method which is required by the getLayer and workspace modules.

Requires

Methods

(async, inner) getLocale(params, parentLocaleopt) → {Promise.<(Object|Error)>}

Nested locales can be requested by providing an array of locale keys. The first locale key will be used to retrieve the locale object and the remaining locale keys will be merged into the first locale as nested locales.

The getLocale method will return an error if the requesting user does not have access to the locale.

Parameters:
NameTypeAttributesDescription
paramsObject
parentLocaleObject<optional>

Locale will be merged into optional parentLocale to create a nested locale.

Properties
NameTypeAttributesDescription
params.localestring<optional>

Locale key.

params.localearray<optional>

An array of locale keys to be merged as a nested locale.

params.userObject<optional>

Requesting user.

user.rolesArray<optional>

User roles.

params.layersBoolean<optional>

Whether to retrieve layers for the locale.

Returns:

JSON Locale.

Type: 
Promise.<(Object|Error)>

(async, inner) mergeParentLocale(locale, parentLocaleopt)

Merges a child locale into a parent locale, composing their properties and updating the nested locale structure.

Parameters:
NameTypeAttributesDescription
localeObject

The locale object to compose.

parentLocaleObject<optional>

Optional parent locale to merge into.