1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-10 05:02:45 +01:00

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

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;