Results 1 to 3 of 3
  1. #1
    rjalori is offline Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    0

    Question 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:

    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());
    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.

    Any help will be much appreciated. Thanks

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,702
    Rep Power
    8

    Default

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

Similar Threads

  1. Replies: 33
    Last Post: 09-06-2010, 10:49 PM
  2. File chooser internationalization problem
    By Astghik in forum AWT / Swing
    Replies: 10
    Last Post: 01-14-2010, 06:44 PM
  3. Replies: 5
    Last Post: 08-21-2009, 11:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •