/workspace/getLocale
The getLocale module exports the getLocale method which is required by the getLayer and workspace modules.
- Source
Requires
- module:/utils/roles
- module:/workspace/mergeTemplates
- module:/workspace/cache
- module:/workspace/getTemplate
Methods
(async, inner) getLocale(params) → {Promise.<(Object|Error)>}
The getLocale method requests the workspace from cache and checks whether the requested locale is a property of the workspace.locales{}.
The workspace.locale is assigned as locale if params.locale is undefined.
The mergeTemplate module will be called to merge templates into the locale object and substitute SRC_* environment variables.
A role check is performed to check whether the requesting user has access to the locale.
Role objects in the locale and nested layers are merged with their respective parent objects.
Parameters:
PropertiesName | Type | Description |
---|---|---|
params | Object |
Name | Type | Attributes | Description |
---|---|---|---|
params.locale | string | <optional> | Locale key. |
params.user | Object | <optional> | Requesting user. |
user.roles | Array | <optional> | User roles. |
Returns:
JSON Locale.
- Type:
- Promise.<(Object|Error)>