AdoptOpenJDK / jitwatch

Log analyser / visualiser for Java HotSpot JIT compiler. Inspect inlining decisions, hot methods, bytecode, and assembly. View results in the JavaFX user interface.
Other
3.04k stars 435 forks source link

Adding support for selecting language dynamically #345

Closed ldebello closed 3 years ago

ldebello commented 3 years ago

Motivation

Following the idea of supporting i18n I think it would be good to select the language from the UI directly.

Note: This is work in progress and I am sending the PR to check if this is something you want to support and if you agree on the approach if you confirm this I can continue working in the final solution and make the remaining components bound to the resource factory

Solution based on https://stackoverflow.com/questions/32464974/javafx-change-application-language-on-the-run

Proposal

Adding a combobox with the available language and instead of setting text directly into components make they bound to a resource factory so a change in the resource factory will make them to update.

Initial UI

image

After changing language

image

Only "Start" translate to "Empezar" because that is the only translation available.

Changes

chriswhocodes commented 3 years ago

Hi @ldebello this looks like a nice clean way to switch languages. Do you think it will work (binding) for all components that can contain translated text (e.g. buttons, labels, perhaps table column headers) ?

I'm happy for you to continue on this path and I will wait until there is a working prototype before I make any more i18n changes so that we don't conflict.

Thank you and to all the translators for your help! I will add your names to the POM as contributors.

ldebello commented 3 years ago

Hi @ldebello this looks like a nice clean way to switch languages. Do you think it will work (binding) for all components that can contain translated text (e.g. buttons, labels, perhaps table column headers) ?

I'm happy for you to continue on this path and I will wait until there is a working prototype before I make any more i18n changes so that we don't conflict.

Thank you and to all the translators for your help! I will add your names to the POM as contributors.

Hi, it should work for all the components I will continue working on this and let you know when it is ready for your review.

ldebello commented 3 years ago

Hi @chriswhocodes the PR is ready for review.

Changes

chriswhocodes commented 3 years ago

Awesome work @ldebello ! I've merged your patch and will start to replace some more of the UI string literals with properties in the lang.properties file :)