(item, ...args)
| 40 | }; |
| 41 | |
| 42 | function T(item, ...args) { |
| 43 | let lang = (window.globals && window.globals.lang) || "en"; |
| 44 | let d = dict(item); |
| 45 | |
| 46 | if(_.isUndefined(d)) { |
| 47 | if (debug && lang !== "en") { |
| 48 | let x = window.globals.dict || {}; |
| 49 | x[item] = item; |
| 50 | window.globals["dict"] = x; |
| 51 | console.log(lang, ": No translation for ", item); |
| 52 | } |
| 53 | |
| 54 | // If there is no specific translation in the target language |
| 55 | // we use the English one, and failing that the name of the |
| 56 | // item directly. |
| 57 | d = English[item] || item; |
| 58 | } |
| 59 | if (typeof d === 'function') { |
| 60 | return d.call(null, ...args); |
| 61 | } |
| 62 | return d; |
| 63 | }; |
| 64 | |
| 65 | export default T; |
no test coverage detected