React native doesn't like relative require calls. So use __dirname and
replace relative requires with absolute ones. Fall back to relative
require if __dirname is not present (for whatever reason).
Fixes #5252 and #5214
try {
oldLocale = globalLocale._abbr;
var aliasedRequire = require;
- aliasedRequire('./locale/' + name);
+ aliasedRequire((typeof __dirname !== undefined ? __dirname : '.') + '/locale/' + name);
getSetGlobalLocale(oldLocale);
} catch (e) {
// mark as not found to avoid repeating expensive file require call causing high CPU