Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Problem reading Locale information on MAC Lynx Internationalization issue

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem reading Locale information on MAC Lynx 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:

    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
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Problem reading Locale information on MAC Lynx Internationalization issue

    This thread has been cross posted here:

    http://www.java-forums.org/awt-swing/46880-problem-reading-locale-information-mac-internationalization-issue.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] Problem in File Reading...
    By Mr.777 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 20th, 2011, 07:24 AM
  2. Problem reading from server socket
    By glauber in forum Java Networking
    Replies: 0
    Last Post: February 15th, 2011, 12:54 PM
  3. Reading from Text File and Processing Information
    By royalslim in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: December 13th, 2010, 03:27 PM
  4. issue with reading a clob variable from oracle
    By computerbum in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 28th, 2010, 06:08 PM
  5. Problem on reading file in Java program
    By nathanernest in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: April 13th, 2009, 08:14 AM