Constructor
new Interpreter(Client)
- Source:
Creates a new Localisations instance
Parameters:
Name | Type | Description |
---|---|---|
Client |
Client | instance |
Methods
getStrings(keyopt, localeopt) → (nullable) {String}
- Source:
Gets strings under a group key from a locale
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
String |
<optional> |
'common'
|
The string group to find |
locale |
String |
<optional> |
'en'
|
The locale to find |
Returns:
- Type
- String
locate(key, obj) → (nullable) {String}
- Source:
Locate a nested key within an object
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The key to find |
obj |
Object | The object to search from |
Returns:
- Type
- String
parse(string, groupopt, localeopt, optionsopt) → {String}
- Source:
Parses a string, converting keys to the matching locale string, with interpolation
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
string |
String | The string to parse |
||
group |
String |
<optional> |
'default'
|
The string group to use |
locale |
String |
<optional> |
'en'
|
The locale to use |
options |
Object |
<optional> |
Object containing tags to interpolate into the string |
Returns:
- Type
- String
register(strings, localeopt)
- Source:
Registers a string table for a locale
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
strings |
String | Object | Array | An object, array or relative path to a folder or file to load strings from |
|
locale |
String |
<optional> |
The name of the locale. If none is supplied, |
reload() → {Client}
- Source:
Reloads locale files (only those that have been added from by file path)
Returns:
- Type
- Client
shift(string, options) → {String}
- Source:
Parses a string and interpolating tags from a supplied object
Parameters:
Name | Type | Description |
---|---|---|
string |
String | String to do interpolation |
options |
Object | Object containing tags to interpolate into the string |
Returns:
- Type
- String