Results 1 to 6 of 6

Thread: Language List

  1. #1
    testing is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default Language List

    Hi!

    Does somebody know how to get a correct language list with getISOLanguages() and getDisplayLanguage()? It's about the ISO-Code change & compatibility issue. Is there a method in Java which can do that? If not, what are the solutions?

    Many thanks in advance!

    Cheers,
    testing

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,519
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by testing View Post
    Is there a method in Java which can do that
    Can do what? ISO codes don't change much ...

    kind regards,

    Jos

  3. #3
    testing is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    In general not. Here the codes for ISO 639-1 changed 1989 and they are still supported to day. I would like to have a method, which can give me a CORRECT list of languages with NO DUPLICATE entries.

    The idea is that the function should do the work for me. To check manually for these codes can lead to some problems if the codes change again ... How have you guys faced this problem since 20 years? Come on, someone of you has to know that. It seems that nobody uses that function, but I can't imagine that. A list of languages can be used in many applications ...
    Last edited by testing; 11-24-2009 at 10:22 PM.

  4. #4
    testing is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    How can I call getISO3Languages() method?

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,519
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by testing View Post
    How can I call getISO3Languages() method?
    There is no such method (plural); there is a getISO3Language() (singular) method; you can do this:

    Java Code:
    String[] ls= Locale.getISOLanguages();
    		
    for (String l : ls) 
    	System.out.println(new Locale(l).getISO3Language());
    kind regards,

    Jos

  6. #6
    testing is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    Thank you very much JosAH!

    It seems that getDisplayLanguage cannot handle 3-letter-codes.

    Java Code:
    		String[] ls= Locale.getISOLanguages();
    		String temp =new String();
    		for (String l : ls){ 
    			temp=new Locale(l).getISO3Language();
    			System.out.println(new Locale(temp, "").getDisplayLanguage(Locale.ENGLISH));
    		}
    If the name returned cannot be localized according to inLocale, (say, we don't have a Japanese name for Croatian), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value
    So impossible?

Similar Threads

  1. Replies: 2
    Last Post: 11-22-2009, 05:24 PM
  2. Replies: 3
    Last Post: 11-21-2009, 05:48 PM
  3. Replies: 5
    Last Post: 08-25-2009, 09:41 AM
  4. Linked List integer list
    By igniteflow in forum Advanced Java
    Replies: 1
    Last Post: 12-10-2008, 08:53 PM
  5. How to access ArrayList in List of List?
    By alvations in forum New To Java
    Replies: 5
    Last Post: 10-08-2008, 12:23 PM

Posting Permissions

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