/workspace/getLocale
The getLocale module exports the getLocale method which is required by the getLayer and workspace modules.
- Source
Requires
- module:/utils/envReplace
- module:/utils/merge
- module:/workspace/cache
- module:/workspace/composeObj
- module:/workspace/getTemplate
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.
| Name | Type | Attributes | Description |
|---|---|---|---|
params | Object | ||
parentLocale | Object | <optional> | Locale will be merged into optional parentLocale to create a nested locale. |
| Name | Type | Attributes | Description |
|---|---|---|---|
params.locale | string | <optional> | Locale key. |
params.locale | array | <optional> | An array of locale keys to be merged as a nested locale. |
params.user | Object | <optional> | Requesting user. |
user.roles | Array | <optional> | User roles. |
params.layers | Boolean | <optional> | Whether to retrieve layers for the locale. |
- Source
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.
| Name | Type | Attributes | Description |
|---|---|---|---|
locale | Object | The locale object to compose. | |
parentLocale | Object | <optional> | Optional parent locale to merge into. |
- Source