Package JavaFX applications with i18n not working

Answered

I worte javafx with i18n properties file which is  inclued chinese and english and it's working fine.

But when I Package JavaFX applications with Create a new artifact configuration and run the program

The chinese is't show up, only the default English text is showup.

What I am missing? 

0
3 comments
Avatar
Yaroslav Bedrov

Hello,

Is it possible to attach screenshots with proper and wrong UI?

0

I have two properties files one is for englisth, the other is for chinese

In strings_en_us.properties

lab_language=Langeage

In strings_zh_cn.properties

lab_language=语言

And java code as following

locale = new Locale("zh", "cn"); 
bundle = ResourceBundle.getBundle("strings", locale);
System.out.println("Lang:" + bundle.getString("lab_language"));

When running in IntellJ IDE it work fine and print out

"Lang:语言"

But when I package javafx with artifact and create the bundles folder, then Run the "exe" file in buldles folder, it will show

"Lang:Langeage"

Why the bundles exe version missing the string in the strings_zh_cn.properties file?

The exe file path show as following

0

Hmm, it's solved 😄

I just rename the properties file name

strings_en_us.properties --> strings_en_US.properties

strings_zh_cn.properties --> strings_zh_CN.properties

It must be capitalize in the packaged jar file.

0

Please sign in to leave a comment.