* Get the message or object corresponding to `key` * * `key` may be a `string` for functions at the root level, or `string[]` for * accessing hierarchical objects. If an exact match is not found, the fallback * locales are checked for the first match. * * If `key` maps to a message
(key, props, lc)
| 268 | * @returns {string|Object<string,function|object>} |
| 269 | */ |
| 270 | get(key, props, lc) { |
| 271 | if (!lc) lc = this.locale; |
| 272 | let msg = _get(this._data[lc], key); |
| 273 | if (msg) return typeof msg == 'function' ? msg(props) : msg; |
| 274 | const fb = this.getFallback(lc); |
| 275 | for (let i = 0; i < fb.length; ++i) { |
| 276 | msg = _get(this._data[fb[i]], key); |
| 277 | if (msg) return typeof msg == 'function' ? msg(props) : msg; |
| 278 | } |
| 279 | return key; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /** @private */ |
no test coverage detected