renamed localization ctx global to reduce the chance of collision (seen in sentry)

This commit is contained in:
Danny Coates 2018-02-07 19:18:11 -08:00
parent a78150b7ad
commit a777a808ee
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
1 changed files with 4 additions and 4 deletions

View File

@ -38,14 +38,14 @@ module.exports = \`
if (typeof window === 'undefined') {
var fluent = require('fluent');
}
var ctx = new fluent.MessageContext('${locale}', {useIsolating: false});
ctx._messages = new Map(${toJSON(merged)});
var fluentContext = new fluent.MessageContext('${locale}', {useIsolating: false});
fluentContext._messages = new Map(${toJSON(merged)});
function translate(id, data) {
var msg = ctx.getMessage(id);
var msg = fluentContext.getMessage(id);
if (typeof(msg) !== 'string' && !msg.val && msg.attrs) {
msg = msg.attrs.title || msg.attrs.alt
}
return ctx.format(msg, data);
return fluentContext.format(msg, data);
}
if (typeof window === 'undefined') {
module.exports = translate;