Opened 4 years ago

Closed 4 years ago

Last modified 14 months ago

#17344 closed defect (fixed)

language prompt should enumerate available langpacks

Reported by: mcs Owned by: brade
Priority: Medium Milestone:
Component: Applications/Tor Launcher Version:
Severity: Normal Keywords: TorBrowserTeam201511R
Cc: brade, gk, intrigeri Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

In #12967, we are adding a language prompt to Tor Launcher. In the current implementation, the list of available languages is hard-coded. We should instead enumerate the installed language packs and only show those languages. Perhaps we should also suppress the prompt if there is only one language to choose from.

Child Tickets

Change History (9)

comment:1 Changed 4 years ago by mcs

Severity: Normal

Code like the following can be used to enumerate the installed language add-ons:

let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");

AddonManager.getAddonsByTypes(["locale"], function(aList)
  {
    for (let addon of aList)
    {
      let uri = addon.getResourceURI("");
      dump(addon.id + ": name: \"" + addon.name + "\", uri: " + uri.spec + "\n");
    }
  });

The output from the above code looks like this:

langpack-es-ES@firefox.mozilla.org: name: "Español (España) Language Pack", uri: file:///Users/brade/Desktop/tb-esr38.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-es-ES@firefox.mozilla.org.xpi
langpack-da@firefox.mozilla.org: name: "Dansk (da) Language Pack", uri: file:///Users/brade/Desktop/tb-esr38.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-da@firefox.mozilla.org.xpi
langpack-de@firefox.mozilla.org: name: "Deutsch (DE) Language Pack", uri: file:///Users/brade/Desktop/tb-esr38.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-de@firefox.mozilla.org.xpi

There does not seem to be an easy way to determine the locale (e.g., es-ES), so we may need to extract it from the id or uri. Similarly, we may need to obtain a language name to show to the user by parsing the name property (ugh). We can also include a locale-to-name lookup table in our code for the language packs we currently include in our packages.

comment:2 Changed 4 years ago by gk

Marking the nightly bug (#17399) as duplicate of this one.

comment:3 Changed 4 years ago by gk

Parent ID: #12967

comment:4 Changed 4 years ago by gk

Keywords: TorBrowserTeam201511 added

comment:5 Changed 4 years ago by gk

Cc: gk added

comment:6 Changed 4 years ago by mcs

Keywords: TorBrowserTeam201511R added; TorBrowserTeam201511 removed
Status: newneeds_review

comment:7 Changed 4 years ago by gk

Nice work! I found just two nits: s/Removed the hard-coded/Remove the hard-coded/ and a superfluous white space after try in

  let curLocale;
  try 

comment:8 Changed 4 years ago by mcs

Resolution: fixed
Status: needs_reviewclosed

Thanks for the review! (and sorry about the trailing whitespace; Kathy and I need to improve our git workflow to catch that every time). We fixed the issues you raised and committed this to master as 20f01697b19ce938b894634d3ca4e39218137ea4.

comment:9 Changed 14 months ago by intrigeri

Cc: intrigeri added
Note: See TracTickets for help on using tickets.