-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VPN-6649: fix translations for cities with special characters #10029
VPN-6649: fix translations for cities with special characters #10029
Conversation
This is ready for review, but I'm leaving it on draft to ensure we do not merge it before mozilla-l10n/mozilla-vpn-client-l10n#488 is merged. |
scripts/ci/update_server_names.py
Outdated
@@ -61,8 +61,15 @@ def fetch_server_list(): | |||
string_map = countries | |||
for city in cities: | |||
# Remove state suffix, capitalize each work, remove spaces. | |||
id = city.split(",")[0].strip().title().replace(" ", "") | |||
string_map[id] = city | |||
baseId = city.split(",")[0].strip().title().replace(" ", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to obtain the same with this code
id = city.split(",")[0].strip().title().replace(" ", "")
id = re.sub(r'[^A-Za-z\s]', '', id)
string_map[id] = city
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, thanks! Updated this.
I didn't include the white space check (\s
), as I don't think we need it. We remove all spaces in the first line (.replace(" ", "")
). While no current city names have any other whitespace characters, we'd want to remove them if they did.
Off draft, as the first l10n PR is merged. |
106f33d
to
b6c928c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Description
Malmö is the only city with special characters in the name. Our build scripts should handle this fine - and we use
Servers.Malm
for the string ID. It builds perfectly on my machine, but was failing on TaskCluster. This failure was due to taskcluster not handling special characters in string IDs in the same way my machine does, apparently. While special characters should be removed from string IDs, they weren't being removed.This PR adds "cleaning of special characters" on the front end - before we pass the string IDs to the translation repo. Thus, we'll now keep the ID as
servers.Malm
for the round trip journey from our client repo to the translation repo and back.VPN-6649 will be fixed as 4 separate PRs, merged in order:
servers.Malmö
toservers.Malm
(Copyservers.Malmö
translations toservers.Malm
mozilla-l10n/mozilla-vpn-client-l10n#488)servers.Malmö
translations.More details from my research:
Localizer::getTranslatedCityName
, we have the following values on my machine onmain
branch:cityName Malmö / parsedCityName Malm / i18nCityId ServersMalm / value Μάλμε
. On TaskCluster (onmain
), we get the same ones with one exception - value isMalmö
.value
is created here, this seems to imply it's an issue with the translation that Qt is pulling out.<message id="servers.Malmö">
When building locally, I get the same thing. This is inbuild/translations/generated/mozillavpn_el.ts
. This makes sense, asservers.Malmö
is the string ID used in the translation repo.lconvert
to convert it to a binaryqm
file.qm
files are binary, and are somewhat of a black box to us.lconvert
or loading the files when running the client, special characters should get stripped out from the translation ID. And they are on my machine, but not on TaskCluster. In both cases, what happens at this level is somewhat unknown, as they get deep Qt's handling of translations - it's deeper than our translation scripts (for creating translation files or loading them into the client).(A different approach to solving this bug was taken in #9964 - that PR is being closed in favor of this one.)
Reference
VPN-6649
Checklist