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

User interface localization #192

Closed
skyjake opened this issue Mar 3, 2021 · 68 comments
Closed

User interface localization #192

skyjake opened this issue Mar 3, 2021 · 68 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@skyjake
Copy link
Owner

skyjake commented Mar 3, 2021

All user-visible strings should be looked up via a translation table so the UI can be localized to different languages.

In practice, wherever there is a user-visible string, it should be replaced with a lookup key. The keys could start with a special symbol, for instance $menu.tab.new. Widgets could then perform the lookup from the translation table and keep a pointer to the user-visible string. When the language is changed at runtime, widgets can then just redo the lookup and everything will instantly update.

Dynamically formatted text is a challenge of its own, but one solution is to translate the format string and use numbered arguments so the order can be changed in the translation (like in Qt).

EDIT: There is now a Weblate server where you can contribute translations: https://weblate.skyjake.fi/projects/lagrange/ui/. Contact me if you want to start translating a new language.

@skyjake skyjake added the enhancement New feature or request label Mar 3, 2021
@sikmir
Copy link
Contributor

sikmir commented Mar 21, 2021

I would like to help with translating to Russian and Finnish.

@skyjake
Copy link
Owner Author

skyjake commented Mar 21, 2021

Thanks for the offer! Although I'll probably do Finnish myself, being a native speaker. 🙂 (for dev purposes, too)

@sikmir
Copy link
Contributor

sikmir commented Mar 21, 2021

I suggest to use Weblate, it's free for open source projects.

@skyjake
Copy link
Owner Author

skyjake commented Mar 21, 2021

That's a good idea. I'll look into the supported file formats on Weblate and see what would work best for Lagrange.

@laosb
Copy link
Contributor

laosb commented Mar 21, 2021

Want to see this happening! I would like to help with Chinese translation.

skyjake added a commit that referenced this issue Mar 22, 2021
skyjake added a commit that referenced this issue Mar 22, 2021
Added a set of English strings. Lang can load a language.
LabelWidget can replace IDs in the label.

IssueID #192
skyjake added a commit that referenced this issue Mar 23, 2021
Use char pointer ranges for the array of IDs and strings to avoid allocations.

Translate macOS menu items.

IssueID #192
skyjake added a commit that referenced this issue Mar 23, 2021
skyjake added a commit that referenced this issue Mar 23, 2021
More or less everywhere?

IssueID #192
skyjake added a commit that referenced this issue Mar 23, 2021
@skyjake
Copy link
Owner Author

skyjake commented Mar 23, 2021

@sikmir @laosb I've set up a self-hosted Weblate at weblate.skyjake.fi. You're most welcome to create an account and start translating! 🙂

Let me know if you run into any issues with the site. It seems to be working for me at least.

@laosb
Copy link
Contributor

laosb commented Mar 23, 2021

@skyjake Hi I've set up my account, but there's no option for translating to Chinese. Could you add it?

@skyjake
Copy link
Owner Author

skyjake commented Mar 23, 2021

Which one would you like:

Chinese (Min Nan) (nan)
Chinese (Pinyin) (zh_Latn)
Chinese (Simplified) (zh_Hans)
Chinese (Simplified, Singapore) (zh_Hans_SG)
Chinese (Traditional) (zh_Hant)
Chinese (Traditional, Hong Kong) (zh_Hant_HK)

@laosb
Copy link
Contributor

laosb commented Mar 23, 2021

I believe Chinese (Pinyin) is not really Chinese, just the pronunciation assisting symbols. I'm native in Simplified Chinese, and can help with Traditional Chinese.

@skyjake
Copy link
Owner Author

skyjake commented Mar 23, 2021

All right, added!

@skyjake
Copy link
Owner Author

skyjake commented Mar 23, 2021

@laosb I added you to the Translators group so you should be able to save the translations directly now.

@laosb
Copy link
Contributor

laosb commented Mar 23, 2021

Oh, OK, thank you!

@sikmir
Copy link
Contributor

sikmir commented Mar 23, 2021

@skyjake "Save" button is disabled, I can only "Suggest" translation. Is it some restriction?

@skyjake
Copy link
Owner Author

skyjake commented Mar 23, 2021

@sikmir I've added you to the Translators, too. By default, users can suggest only.

skyjake added a commit that referenced this issue Mar 23, 2021
skyjake added a commit that referenced this issue Mar 23, 2021
@Carmina16
Copy link
Contributor

Please add Interlingue (code: ie).

skyjake added a commit that referenced this issue Mar 24, 2021
skyjake added a commit that referenced this issue Mar 24, 2021
@Carmina16
Copy link
Contributor

Is it possible to give me ("OIS") the translator rights for Interlingua [ia] and Interlingue [ie]?

@skyjake
Copy link
Owner Author

skyjake commented Mar 25, 2021

@Carmina16 I've added you as a translator.

@laosb
Copy link
Contributor

laosb commented Mar 25, 2021

Just finished translating to zh-Hans. Will work on translating to zh-Hant later.

Any chance getting some test build to see the real world performance?

skyjake added a commit that referenced this issue Mar 25, 2021
@sikmir
Copy link
Contributor

sikmir commented Mar 30, 2021

Maybe the keyboard key names should also be translated?

I think it's better to leave it as-is, translating "Ctrl/Alt/Shift/Meta/Caps/Space/Esc" seems weird.

@Carmina16
Copy link
Contributor

Yes, keyboard keys should be translatable.

Also, it possible to embed English strings for missing entries in translation files instead of the identifiers?

@skyjake
Copy link
Owner Author

skyjake commented Mar 31, 2021

embed English strings for missing entries in translation files instead of the identifiers?

That is not possible at the moment. I could enable this for selected things like the keyboard key names, which mostly come from SDL.

@laosb
Copy link
Contributor

laosb commented Apr 1, 2021

I'm not sure about how to do that, but to ensure quality, it's better to include both TC and SC variants of Noto Sans CJK, and switch to the corresponding one accordingly.

Also it might be a good idea to switch for content according to the Gemini header lang={}.

@MCMic
Copy link
Contributor

MCMic commented Apr 1, 2021

@skyjake Hello, can I be added to translators for French? (MCMic account on the weblate)

Also I’d love to see an esperanto translation, but I’m not good enough to do it.

@skyjake
Copy link
Owner Author

skyjake commented Apr 1, 2021

@MCMic You should now have translator rights, please go ahead.

I’ve added Esperanto, too. Let’s see if someone volunteers to do it...

@sikmir
Copy link
Contributor

sikmir commented Apr 1, 2021

Also I’d love to see an esperanto translation, but I’m not good enough to do it.

+1, I also learned Esperanto and can help with it a bit.

@skyjake
Copy link
Owner Author

skyjake commented Apr 1, 2021

@laosb

I'm not sure about how to do that, but to ensure quality, it's better to include both TC and SC variants of Noto Sans CJK, and switch to the corresponding one accordingly.

I'm planning to implement #195 (downloadable fonts) so there can be a larger variety of fonts available, and every update doesn't have to include the full set of fonts. Switching based on the UI language shouldn't be a big issue.

Also it might be a good idea to switch for content according to the Gemini header lang={}.

This is doable, although requires the server to send the correct the language parameter. I wonder how often this is present in practice?

@skyjake
Copy link
Owner Author

skyjake commented Apr 3, 2021

@Carmina16 Is it appropriate to label ie as "Occidental" also in the Lagrange UI, or should I use "Interlingue"? Keeping in mind that "Interlingua" could also be included when finished.

EDIT: Going with "Interlingue" for now as "Occidental" seems obsolete according to Wikipedia.

skyjake added a commit that referenced this issue Apr 3, 2021
@Carmina16
Copy link
Contributor

Interlingue is OK.

skyjake added a commit that referenced this issue Apr 26, 2021
skyjake added a commit that referenced this issue May 3, 2021
skyjake added a commit that referenced this issue May 4, 2021
skyjake added a commit that referenced this issue May 13, 2021
@skyjake skyjake closed this as completed Jun 6, 2021
@balazsbotond
Copy link
Contributor

I would like to translate Lagrange into Hungarian. Could you please start the new translation on Weblate?

@skyjake
Copy link
Owner Author

skyjake commented Nov 4, 2021

I've now added Hungarian. Did you already register a user account on Weblate? Let me know the username and I'll give you translator access rights, otherwise you can only suggest strings.

@balazsbotond
Copy link
Contributor

Thank you! I've just registered, my username is balazsbotond.

@skyjake
Copy link
Owner Author

skyjake commented Nov 4, 2021

You now have the access rights. 🙂

@balazsbotond
Copy link
Contributor

I finished the translation. Thanks for your help!

@skyjake
Copy link
Owner Author

skyjake commented Nov 4, 2021

Wonderful! This will be included in v1.8.1.

One more string, though: I added lang.hu for the language dropdown menu.

@balazsbotond
Copy link
Contributor

Great, I'm looking forward to the new version!

I've translated lang.hu too.

@balazsbotond
Copy link
Contributor

I built the project and checked the translated UI. I made some minor corrections to the strings in Weblate based on what I saw, but now the Hungarian translation can be considered complete.

I also discovered that translated strings aren't being applied to a tiny part of the UI, even though they are present in Weblate ("Normal" and "Fill", keys prefs.linewidth.normal and prefs.linewidth.fill):
2021-11-04-152052_1073x305_scrot

@skyjake
Copy link
Owner Author

skyjake commented Nov 4, 2021

If you close and reopen the dialog, those should get translated as well?

There are also other minor glitches with language switches, I'll make a note about this one.

@balazsbotond
Copy link
Contributor

You're right, closing and reopening the dialog solves it.

@BoFFire
Copy link

BoFFire commented Feb 11, 2022

Hi @skyjake Can you add arabic language ar. Will try to contribute. I'm ButterflyOfFire on Weblate. Thanks.

@skyjake
Copy link
Owner Author

skyjake commented Feb 11, 2022

@BoFFire I've added "Arabic (ar)". I'll probably need to rearrange some UI elements for a more appropriate RTL layout, but having the UI strings first would be great. 👍 Also, you now have Translator access rights.

@sikmir
Copy link
Contributor

sikmir commented Jan 22, 2023

I’ve added Esperanto, too. Let’s see if someone volunteers to do it...

@skyjake Could you please add Esperanto Glossary as well? I have no permissions for that.

@skyjake
Copy link
Owner Author

skyjake commented Jan 22, 2023

@sikmir Ok, added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants