/[schmitzm]/trunk/src/skrueger/i8n/I8NUtil.java
ViewVC logotype

Diff of /trunk/src/skrueger/i8n/I8NUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1100 by alfonx, Mon Oct 11 00:07:14 2010 UTC revision 1150 by alfonx, Mon Oct 18 12:28:24 2010 UTC
# Line 36  import java.util.Set; Line 36  import java.util.Set;
36  import java.util.TreeSet;  import java.util.TreeSet;
37    
38  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
 import org.geotools.resources.i18n.Locales;  
39    
40  public class I8NUtil {  public class I8NUtil {
41          static final Logger LOGGER = Logger.getLogger(I8NUtil.class);          static final Logger LOGGER = Logger.getLogger(I8NUtil.class);
# Line 44  public class I8NUtil { Line 43  public class I8NUtil {
43          private static Set<String> languageCodes = new TreeSet<String>();          private static Set<String> languageCodes = new TreeSet<String>();
44          static {          static {
45                  for (final Locale locale : java.util.Locale.getAvailableLocales()) {                  for (final Locale locale : java.util.Locale.getAvailableLocales()) {
46                          getLanguageCodes().add(locale.getLanguage());                          languageCodes.add(locale.getLanguage());
47                    }
48                    for (String code : java.util.Locale.getISOLanguages()) {
49                            languageCodes.add(code);
50                  }                  }
                 // for (String code : java.util.Locale.getISOLanguages()) {  
                 // getLanguageCodes().add(code);  
                 // }  
51          }          }
52    
53          /**          /**
# Line 133  public class I8NUtil { Line 132  public class I8NUtil {
132                  if (locales.size() > 0)                  if (locales.size() > 0)
133                          return locales.get(0);                          return locales.get(0);
134    
135                  LOGGER.error("Can't create a Locale for code " + code                  Locale l = new Locale(code);
136                                  + "! Returning the system default locale to avoid NPEs.");                  LOGGER.error("Can't find Locale for code " + code
137                                    + "! Returning a selfmade locale");
138                    return l;
139    
140                  return Locale.getDefault();                  // return Locale.getDefault();
141          }          }
142    
143          /**          /**

Legend:
Removed from v.1100  
changed lines
  Added in v.1150

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26