fix: turn off bidi characters in favor of <bidi> tags (#2557)

This commit is contained in:
Vinh
2019-09-12 16:10:17 +00:00
committed by Wyatt Johnson
parent ea3c1e3b58
commit 2559d1c0e8
3 changed files with 12 additions and 5 deletions
@@ -44,7 +44,10 @@ export default async function generateBundles(
const promises = [];
for (const locale of locales) {
const bundle = new FluentBundle(locale, { functions });
// `useIsolating: false` will remove bidi characters.
// https://github.com/projectfluent/fluent.js/wiki/Unicode-Isolation
// We should be able to use `<bdi>` tags instead to support rtl languages.
const bundle = new FluentBundle(locale, { functions, useIsolating: false });
if (locale in data.bundled) {
bundle.addMessages(data.bundled[locale]);
promises.push(decorateWarnMissing(bundle));
@@ -38,9 +38,9 @@ function createFluentBundle(
target: string,
pathToLocale: string
): FluentBundle {
// `useIsolating: false` will remove bidi characterse.
// See https://github.com/projectfluent/fluent.js/commit/41e5445d2e399f090306c5b9a084bcce5111bbd3
// And https://www.w3.org/International/questions/qa-bidi-unicode-controls
// `useIsolating: false` will remove bidi characters.
// https://github.com/projectfluent/fluent.js/wiki/Unicode-Isolation
// We should be able to use `<bdi>` tags instead to support rtl languages.
const bundle = new FluentBundle("en-US", { functions, useIsolating: false });
const files = fs.readdirSync(pathToLocale);
const prefixes = commonPrefixes.concat(target);
+5 -1
View File
@@ -49,7 +49,11 @@ export class I18n {
// Now we have a language code.
const bundle: FluentBundle =
this.bundles[locale] || new FluentBundle(locale);
// `useIsolating: false` will remove bidi characters.
// https://github.com/projectfluent/fluent.js/wiki/Unicode-Isolation
// We should be able to use `<bdi>` tags instead to support rtl languages.
this.bundles[locale] ||
new FluentBundle(locale, { useIsolating: false });
// Load all the translations in the folder.
const files = await fs.readdir(path.join(localesFolder, folder));