Skip to content
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-5138: Fix pascal case #9949

Merged
merged 6 commits into from
Oct 11, 2024
Merged

Conversation

mcleinman
Copy link
Collaborator

@mcleinman mcleinman commented Oct 9, 2024

Description

  • The translation in xliff showed an id of servers.Mcallen, which later converts into serversMcallen
  • However, in the code we were looking for serversMcAllen - we weren’t handling capitalization consistently!
  • In update_server_names.py, we are changing the cities to title case: id = city.split(",")[0].strip().title().replace(" ", “”)
  • In Localizer::getTranslatedCityName, we have this line: QString i18nCityId = QString("Servers%1").arg(toPascalCase(parsedCityName));
  • However, toPascalCase had a bug: words[i] = word.at(0).toUpper() + word.mid(1) (bug introduced here: VPN-5175 - Get languages, currencies and server name translations from the l10n repository strings #9448)
  • But, we need to preserve the existing capitalization behavior for language string IDs (used for "how do you translate the word 'Japanese' in a Spanish locale?") as caught by our unit tests.

There is additional bug with Malmö that is part of VPN-5138. This bug is Windows-only. I tried debugging via additional logging in the build (you'll see a bunch of commits related to this, as I needed it to run on TaskCluster), but kept hitting dead ends. I do not have a Windows dev machine, and this would be much easier to debug with one. I've filed this part as https://mozilla-hub.atlassian.net/browse/VPN-6649.

Reference

VPN-5138

Checklist

  • My code follows the style guidelines for this project
  • I have not added any packages that contain high risk or unknown licenses (GPL, LGPL, MPL, etc. consult with DevOps if in question)
  • I have performed a self review of my own code
  • I have commented my code PARTICULARLY in hard to understand areas
  • I have added thorough tests where needed

@mcleinman mcleinman marked this pull request as draft October 9, 2024 23:15
@mcleinman mcleinman force-pushed the vpn-5138-fix-translations-for-cities branch from 14759a5 to 947fd91 Compare October 10, 2024 16:39
@mcleinman mcleinman force-pushed the vpn-5138-fix-translations-for-cities branch 5 times, most recently from 72c5a67 to 3d3823c Compare October 10, 2024 19:33
@mcleinman mcleinman force-pushed the vpn-5138-fix-translations-for-cities branch from 3d3823c to e77f669 Compare October 10, 2024 19:34
@mcleinman mcleinman changed the title VPN-5138: fix pascal case VPN-5138, part 1: Fix pascal case Oct 10, 2024
@mcleinman mcleinman changed the title VPN-5138, part 1: Fix pascal case VPN-5138: Fix pascal case Oct 10, 2024
@mcleinman mcleinman marked this pull request as ready for review October 10, 2024 19:55
Copy link
Member

@lesleyjanenorton lesleyjanenorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R+

}
}

return words.join("");
}

QString toPascalCase(const QString& s) { return changeCasing(s, true); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be helpful to add a comment for our future selves and any poor souls who come after us about when we expect to use toPascalCase vs toLanguageId.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, thanks. Added comments.

@mcleinman mcleinman merged commit 3b7b096 into main Oct 11, 2024
117 checks passed
@mcleinman mcleinman deleted the vpn-5138-fix-translations-for-cities branch October 11, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants