skyjake / lagrange

A Beautiful Gemini Client
https://gmi.skyjake.fi/lagrange/
BSD 2-Clause "Simplified" License
1.21k stars 63 forks source link

User interface localization #192

Closed skyjake closed 3 years ago

skyjake commented 3 years ago

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.

sikmir commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

@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.

Carmina16 commented 3 years ago

Interlingue is OK.

balazsbotond commented 2 years ago

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

skyjake commented 2 years ago

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 commented 2 years ago

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

skyjake commented 2 years ago

You now have the access rights. 🙂

balazsbotond commented 2 years ago

I finished the translation. Thanks for your help!

skyjake commented 2 years ago

Wonderful! This will be included in v1.8.1.

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

balazsbotond commented 2 years ago

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

I've translated lang.hu too.

balazsbotond commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

BoFFire commented 2 years ago

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

skyjake commented 2 years ago

@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 commented 1 year ago

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 commented 1 year ago

@sikmir Ok, added.