imba-localization 0.4.11 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,6 +136,13 @@ new Localization(url, default = 'en')
|
|
|
136
136
|
- `languages`: Object containing all loaded language data
|
|
137
137
|
- `preferred`: Detected browser language (first 2 characters of `navigator.language`)
|
|
138
138
|
|
|
139
|
+
### Methods
|
|
140
|
+
|
|
141
|
+
- `lookup(path, fallback = '')`: Reads a nested value by dot path or path array
|
|
142
|
+
- `text(path, fallback = '', data = null)`: Reads a localized string and replaces `{key}` placeholders from `data`
|
|
143
|
+
- `table(path)`: Reads a nested object table, returning `{}` when missing
|
|
144
|
+
- `render(value, data = null)`: Replaces `{key}` placeholders in any string-like value
|
|
145
|
+
|
|
139
146
|
### Events
|
|
140
147
|
|
|
141
148
|
- `onready`: Called when localization data is successfully loaded
|