tornadofx internationalization to country not available in FX.locale

295 views Asked by At

I'm trying to write an fxml file with a variable in it that I pull from a resource bundle. I want the value of this variable to be pulled in from a different file in my bundle in different locales. This works for the locales that you can specify like this:

FX.locale = Locale.FRENCH

However, Spanish is not an available locale and I have a Spanish language file that I would like to use.

I have heard that, by default, tornadofx gets the locale of your computer and chooses the file in the resource bundle that it thinks is in the language you most likely speak. However, this does not work when I set my locale to Spain; actually, it does not work at all. If I do not specify my locale in my program, it does not pull the variable in from any of my files.

Does anyone know how I could get a foothold into this problem? I have read the documentation located here, but I did not understand what messages were or how to access them. I can make this code work, but only for French and other FX.locale options.

Thank you in advance!

1

There are 1 answers

0
Edvin Syse On BEST ANSWER

Since not all locales have a constant in java.lang.Locale, you can create a locale instance manually and assign it to FX.locale:

FX.locale = Locale("es_ES")