Results 1 to 3 of 3
- 07-25-2011, 07:17 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
Problem reading Locale information on MAC Internationalization issue
I read the current Locale settings on the computer and set the language (properties) file to converting my application to be used on different Locales. This is being done by reading the current regional settings on Windows. On MAC OS, when the jar file is run, it always detects the Locale as en_US and therefore shows the USD as currency and US English as default language. The code that we are running for testing is:
While testing the same on MAC it will always shows US English irrespective of what is set in the preferences section. We have about 10 language files which needs to be used based on the Locale that is set on the client’s machine and also to use the currency symbol, number format and date format.Java Code:Locale lclLanguage; lclLanguage = new Locale(Locale.getDefault().getLanguage(),Locale.getDefault().getCountry()); String strNumberFormat = NumberFormat.getCurrencyInstance(lclLanguage).getCurrency().getSymbol(lclLanguage); JOptionPane.showMessageDialog(null, "Number format: " + strNumberFormat); ResourceBundle rbLangBundle = null; JOptionPane.showMessageDialog(null, "Country: " + lclLanguage.getCountry() + "\r\n" + "Display country: " + lclLanguage.getDisplayCountry() + "\r\n" + "Display Language: " + lclLanguage.getDisplayLanguage() + "\r\n" + "Display name: " + lclLanguage.getDisplayName() + "\r\n" + "Display variant: " + lclLanguage.getDisplayVariant() + "\r\n" + "ISO3Country: " + lclLanguage.getISO3Country() + "\r\n" + "ISO3language: " + lclLanguage.getISO3Language() + "\r\n" + "Language: " + lclLanguage.getLanguage() + "\r\n" + "Variant: " + lclLanguage.getVariant()); rbLangBundle = ResourceBundle.getBundle("MessagesBundle", lclLanguage); JOptionPane.showMessageDialog(null, "OS: " + System.getProperty("os.name")); DecimalFormatSymbols objDecimalFormat; objDecimalFormat = new DecimalFormatSymbols(); JOptionPane.showMessageDialog(null, "Decimal symbol: " + objDecimalFormat.getCurrencySymbol() + "\r\n" + "Decimal separator: " + objDecimalFormat.getDecimalSeparator() + "\r\n" + "Grouping seperator: " + objDecimalFormat.getGroupingSeparator() + "\r\n" + "Percentage: " + objDecimalFormat.getPercent());
Any help will be much appreciated. Thanks
- 07-25-2011, 07:30 PM #2
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 07-26-2011, 07:48 AM #3
Similar Threads
-
Issue in reading .bmp file using javax.swing.ImageIcon
By Cbani in forum AWT / SwingReplies: 33Last Post: 09-06-2010, 10:49 PM -
File chooser internationalization problem
By Astghik in forum AWT / SwingReplies: 10Last Post: 01-14-2010, 06:44 PM -
problem with reading excel sheet data reading using poi libraries
By sandeepsai17 in forum New To JavaReplies: 5Last Post: 08-21-2009, 11:03 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks