(name)
| 2077 | } |
| 2078 | |
| 2079 | function loadLocale(name) { |
| 2080 | var oldLocale = null, |
| 2081 | aliasedRequire; |
| 2082 | // TODO: Find a better way to register and load all the locales in Node |
| 2083 | if ( |
| 2084 | locales[name] === undefined && |
| 2085 | typeof module !== 'undefined' && |
| 2086 | module && |
| 2087 | module.exports |
| 2088 | ) { |
| 2089 | try { |
| 2090 | oldLocale = globalLocale._abbr; |
| 2091 | aliasedRequire = require; |
| 2092 | aliasedRequire('./locale/' + name); |
| 2093 | getSetGlobalLocale(oldLocale); |
| 2094 | } catch (e) { |
| 2095 | // mark as not found to avoid repeating expensive file require call causing high CPU |
| 2096 | // when trying to find en-US, en_US, en-us for every format call |
| 2097 | locales[name] = null; // null means not found |
| 2098 | } |
| 2099 | } |
| 2100 | return locales[name]; |
| 2101 | } |
| 2102 | |
| 2103 | // This function will load locale and then set the global locale. If |
| 2104 | // no arguments are passed in, it will simply return the current global |
no test coverage detected