BaRatin-tools / BaRatinAGE

BaRatin Advanced Graphical Environment
GNU General Public License v3.0
4 stars 0 forks source link

Right-click menu in jfreechart panels should follow the selected langage #27

Closed benRenard closed 5 months ago

benRenard commented 1 year ago

Last time I checked (years ago!), this was not possible: "At the moment, the localisation files are loaded statically according to the default locale. There's no option to configure on-the-fly the locale/language for a given chart or chart-panel. It would be a nice feature to have."

IvanHeriver commented 1 year ago

In BaRatinAGE, the language is set at startup and cannot be changed on-the-fly; hence, the limitation mentioned in the quote doesn't apply in our case.

I tried the following in the src/Utils/config.java file (after loading the language from options/lang.txt )and it actually changed the right click context menu language in jfreechart:

Locale l = new Locale(this.language);
Locale.setDefault(l);

jfreechart context menu

However, the language code might need to be modified for some of the languages. For example, the actual code for Japanese is ja, not jp... (I hard coded the language code to test the context menu shown in the screenshot above).

IvanHeriver commented 5 months ago

This is fixed in BaRatinAGE v3 since the default JFreeChart context menu was removed to the profite of a custom menu which is now correclty translated.