Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Revert "Set useIsolating option for Fluent bundles"
Browse files Browse the repository at this point in the history
  • Loading branch information
punamdahiya committed Oct 10, 2018
1 parent 8a8eb01 commit ebee72d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
15 changes: 4 additions & 11 deletions server/src/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,12 @@ exports.init = function(localeStringMap) {
return initPromise;
};

exports.getText = function(locales, userAgent) {
exports.getText = function(locales) {
const bundles = {};
const availableLocales = exports.getUserLocales(locales);

// This is a temporary fix for https://github.com/mozilla-services/screenshots/issues/4863
// to be reverted in https://github.com/mozilla-services/screenshots/issues/4993
let useIsolating = true;
if (userAgent && userAgent.includes("Win")) {
useIsolating = false;
}

availableLocales.forEach((locale) => {
bundles[locale] = getFluentBundle(locale, useIsolating);
bundles[locale] = getFluentBundle(locale);
});

return function(l10nID, args) {
Expand Down Expand Up @@ -99,9 +92,9 @@ function useLocaleData(localeStringMap) {
return initPromise;
}

function getFluentBundle(locale, useIsolating) {
function getFluentBundle(locale) {
if (!fluentBundles[locale]) {
const bundle = new FluentBundle(locale, {useIsolating});
const bundle = new FluentBundle(locale);
bundle.addMessages(rawStrings[locale]);
fluentBundles[locale] = bundle;
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/middleware/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports.getLanguages = function(req) {
exports.l10n = function(req, res, next) {
l10n.init().then(() => {
const languages = exports.getLanguages(req);
req.getText = l10n.getText(languages, req.headers["user-agent"]);
req.getText = l10n.getText(languages);
req.userLocales = l10n.getUserLocales(languages);
req.messages = l10n.getStrings(languages);
next();
Expand Down
10 changes: 4 additions & 6 deletions server/src/reactruntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ require("fluent-intl-polyfill/compat");
const { FluentBundle } = require("fluent/compat");
const { LocalizationProvider } = require("fluent-react/compat");
const { getLocaleMessages } = require("./locale-messages");
const bundles = [];

function generateBundles(messages, locales) {
const bundles = [];
for (const locale of locales) {
if (!messages[locale]) {
const bundle = new FluentBundle(locale);
bundle.addMessages(messages[locale]);
bundles.push(bundle);
}
const bundle = new FluentBundle(locale);
bundle.addMessages(messages[locale]);
bundles.push(bundle);
}
return bundles;
}
Expand Down

0 comments on commit ebee72d

Please sign in to comment.