Commit a53ac65c authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! BB 41369: Improve Firefox language settings for multi-lingual packages

BB 45360: Move our language setting customization to the new design.
parent 4065ff08
Loading
Loading
Loading
Loading
Loading
+15 −1
Changes for browser/components/preferences/config/languages.mjs: 15 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ export const Multilingual = {
      /** @type {LocaleCode[]} */ (await LangPackMatcher.getAvailableLocales()),
      code => code,
      (code, label) => ({ code, label })
    );
    ).sort((a, b) => (a.code > b.code ? 1 : -1));
  },

  /**
@@ -209,6 +209,20 @@ Preferences.addSetting({
 * @returns {SettingOptionConfig}
 */
function makeBrowserLanguageOption({ code, label }) {
  if (code === "ja-JP-macos") {
    // Mozilla codebases handle Japanese in macOS in different ways, sometimes
    // they call it ja-JP-mac and sometimes they call it ja-JP-macos.
    // The former is translated to Japanese when specifying preferNative to
    // true, the latter is not. Since seeing ja-JP-macos would be confusing
    // anyway, we treat it as a special case.
    // See tor-browser#41372 and Bug 1726586.
    label =
      Services.intl.getLocaleDisplayNames(undefined, ["ja"], {
        preferNative: true,
      })[0] + " (ja)";
  } else {
    label += ` (${code})`;
  }
  return {
    value: code,
    controlAttrs: {
+2 −24
Changes for browser/components/preferences/main.js: 2 added lines, 24 removed lines.
Original line number Diff line number Diff line
@@ -1402,30 +1402,8 @@ var gMainPane = {
      available,
      { preferNative: true }
    );
    let locales = available.map((code, i) => {
      let name = localeNames[i].replace(/\s*\(.+\)$/g, "");
      if (code === "ja-JP-macos") {
        // Mozilla codebases handle Japanese in macOS in different ways,
        // sometimes they call it ja-JP-mac and sometimes they call it
        // ja-JP-macos. The former is translated to Japanese when specifying
        // preferNative to true, the latter is not. Since seeing ja-JP-macos
        // would be confusing anyway, we treat it as a special case.
        // See tor-browser#41372 and Bug 1726586.
        name =
          Services.intl.getLocaleDisplayNames(undefined, ["ja"], {
            preferNative: true,
          })[0] + " (ja)";
      } else {
        name += ` (${code})`;
      }
      return {
        code,
        name,
      };
    });
    // tor-browser#42335: Sort language codes independently from the locale,
    // so do not use localeCompare.
    locales.sort((a, b) => a.code > b.code);
    let locales = available.map((code, i) => ({ code, name: localeNames[i] }));
    locales.sort((a, b) => a.name > b.name);

    let fragment = document.createDocumentFragment();
    for (let { code, name } of locales) {