Skip to content

Bug 40955: Translate the Windows installer.

Pier Angelo Vendrame requested to merge pierov/tor-browser-build:bug_40955 into main

Merge Info

Related Issues

Backporting

Timeline

  • Immediate: patchset needed as soon as possible
  • Next Minor Stable Release: patchset that needs to be verified in nightly before backport
  • Eventually: patchset that needs to be verified in alpha before backport
  • No Backport (preferred): patchset for the next major stable

(Optional) Justification

  • Emergency security update: patchset fixes CVEs, 0-days, etc
  • Censorship event: patchset enables censorship circumvention
  • Critical bug-fix: patchset fixes a bug in core-functionality
  • Consistency: patchset which would make development easier if it were in both the alpha and release branches; developer tools, build system changes, etc
  • Sponsor required: patchset required for sponsor
  • Other: please explain

Issue Tracking

Review

Request Reviewer

  • Request review from an applications developer depending on modified system:
    • NOTE: if the MR modifies multiple areas, please /cc all the relevant reviewers (since gitlab only allows 1 reviewer)
    • accessibility : henry
    • android : clairehurst, dan
    • build system : boklm
    • extensions : ma1
    • firefox internals (XUL/JS/XPCOM) : jwilde, ma1
    • fonts : pierov
    • frontend (implementation) : henry
    • frontend (review) : donuts, richard
    • localization : henry, pierov
    • macOS : clairehurst, dan
    • nightly builds : boklm
    • rebases/release-prep : boklm, dan, ma1, pierov, richard
    • security : jwilde, ma1
    • signing : boklm, richard
    • updater : pierov
    • windows : jwilde, richard
    • misc/other : pierov, richard

Change Description

In this commit, we stop using hardcoded English strings for the Windows installer, and start translating them.

NSIS requires to insert the language strings in the source code of the strings, which has a few problems:

  1. Weblate doesn't support this format (Crowdin does)
  2. Trusting a completely automated process with source code doesn't feel right
  3. I don't know if Crowdin would give us the possibility to enable/disable languages (it isn't a problem with Weblate).

So, I decided to create a Python script to parse strings in a more standard format, escape the strings as we prefer, and then add them to the NSIS script.

I chose .ini, because it's a super easy monolingual format (key=string). Monolingual is a better choice in this context, because NSIS refers to strings by key.

I also evaluated forcing gettext to monolingual (Weblate supports it), but eventually I discarded the option because:

  • it was harder to setup in Python (I really tried, but at a certain point I gave up, because the effort wasn't worth, given the simplicity of this use case)
  • I didn't find an API to list the strings (I'm trying to reduce the redundancy) - but we could use regex as a workaround (see the script to extract strings from the NSIS file)
  • I expect the difference for the users to be minimal (Weblate does a lot to improve the UX)

I also evaluated JSON, but JSON doesn't really support comments.

The ini file for the translation repository aren't included here, but I have them in a couple of branches in my translation.git fork.

There are still a few things to iron out, but I'm starting threads in the MR for them, so that GitLab forces us to solve them 🙂.

How Tested

Nightly build at https://tb-build-03.torproject.org/~pierov/mullvadbrowser/nightly/tbb-nightly.2024.05.29/.

The final installer won't prompt for the language, will use the one from the OS, but I added it for this test build so that we could change language.

At the moment, I added only translations for Italian (in addition to English; other languages will have empty strings - more on this later).

/cc @emmapeel @ruihildt

Merge request reports

Loading