MovingBlocks / TerasologyLauncher

Terasology Launcher is the official launcher for the open source game Terasology.
http://terasology.org/
Apache License 2.0
154 stars 76 forks source link

i18n: use properties and bindings for i18n of resources bundles #679

Closed skaldarnar closed 1 year ago

skaldarnar commented 2 years ago

Contains

Based on https://sodocumentation.net/javafx/topic/5434/internationalization-in-javafx

Contributes to #505.

How to test

This binds the translation of labels and tooltips to the current settings.

For good measure, switch up the steps, close and restart in between, etc.

Also, please take note of any labels or texts that do not update when changing the locale.

Outstanding before merging

jdrueckert commented 2 years ago

Looks good to me code-wise, but I still need to test it. I currently plan to test it tomorrow, so please ping me again if I didn't review/comment again until the day after tomorrow.

skaldarnar commented 1 year ago

To answer your comments

  • settings view: logging level label
  • settings view: show pre-releases and nightly builds checkbox

They do update for me when I test with the latest code ... :roll_eyes:

Peek 2022-11-02 20-10.webm

  • settings view: advanced options details section title
  • main view: tab titles

The tab names just don't have translations. Code-wise, the label binding is in place and they would update if we'd provide translations for them. Same holds for the "advanced options" section title.

https://github.com/MovingBlocks/TerasologyLauncher/blob/b9c1ee0d5d7651a42a9ab39189c1a45a6dfe45d4/src/main/java/org/terasology/launcher/ui/ApplicationController.java#L258-L260

skaldarnar commented 1 year ago

[...] in the settings view, the initial and max memory drop-down "not used" default stays in English when changing the language.

I have no clue how I can get the selected cell of the check box to update when the locale changes. I tried a custom cell factory in which I bind the text property, but that also did not help. I cannot find anything like TableView#refresh for the ComboBox, so the only thing left would be a hacky "listen to locale changes and re-create the whole combo boxes each time"... Or the there is a smarter way and I'm just to dump to see it... :confused:

jdrueckert commented 1 year ago

They do update for me when I test with the latest code ... :roll_eyes:

Seems I only tested with languages that don't have a translation for them yet :sweat_smile: When I select German, it works :+1:

jdrueckert commented 1 year ago

The tab names just don't have translations. Code-wise, the label binding is in place and they would update if we'd provide translations for them. Same holds for the "advanced options" section title.

FYI: I added german translations for these in https://github.com/MovingBlocks/TerasologyLauncher/pull/682

skaldarnar commented 1 year ago

Thanks for the review :green_heart: Will address the remaining comments in a follow-up PR.