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

Improve default translation using preferred keys #13078

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

msujew
Copy link
Member

@msujew msujew commented Nov 16, 2023

What it does

Related to a comment in #13028.

Adds support for entering preferred translation keys for the nls.metadata.json translation process. This issue in particular is seen because there are ~5 different entries that translate to File in the metadata file. The last one is translated differently compared all others. This isn't an issue usually, since all entries that use the same english value translate to the same value in any other language.

For this case, we now have a set of "preferred keys" that have priority over other keys. This currently only seems to be necessary for the File entry, but contributors can any keys in there to improve localization.

How to test

  1. Change the locale of the application to something other than English
  2. The "File" menu entry should be translated to whatever "File" in your selected language is. It shouldn't show the translation for "local file".

Review checklist

Reminder for reviewers

@msujew msujew added the localization issues related to localization/internalization/nls label Nov 16, 2023
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

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

Change looks good to me and definitely solves the problem with the 'File' menu entry having the wrong translation. So we can definitely merge this, thank you Mark!

Just to make it very clear: The idea here is to have Theia maintain this list of preferred keys, is that right? Cause there is no way as an application to contribute to this list or override/extend the LocalizationKeyProvider.

@msujew
Copy link
Member Author

msujew commented Nov 22, 2023

The idea here is to have Theia maintain this list of preferred keys, is that right? Cause there is no way as an application to contribute to this list or override/extend the LocalizationKeyProvider.

Yes, adopters shouldn't really use nls.localizeByDefault (which is the only consumer of this API) anyway. Adopters should provide their own translations. We just do it because we would need to provide 1000+ translations, which are contributed by language packs anyway.

@martin-fleck-at
Copy link
Contributor

@msujew Great, thank you for the clarification!

@msujew msujew merged commit 964f69c into master Nov 22, 2023
13 checks passed
@msujew msujew deleted the msujew/preferred-nls-keys branch November 22, 2023 12:32
@github-actions github-actions bot added this to the 1.44.0 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
localization issues related to localization/internalization/nls
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants