简体   繁体   中英

How do I get my application to inherit the language a user selects in the install4j installer?

I've created a multi-language installer, using install4j. All screens of the installer reflect the selected language, and my language .jar files are being created and put into a folder in the installation directory. I'm having trouble bridging the gap between installer and application as far as language selection goes.

In your application, call

String language = (String)Variables.getInstallerVariable("sys.languageId")

to get the language that was selected in the installer. To set this as your default locale, call

Locale.setDefault(new Locale(language));

The Variables class above is in the JAR file resources/i4jruntime.jar, use this JAR file for compilation, but do no distribute it, it will automatically be on the class path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM