abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1174332 - /abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java
Date Thu, 22 Sep 2011 19:23:33 GMT
Author: jmsnell
Date: Thu Sep 22 19:23:33 2011
New Revision: 1174332

URL: http://svn.apache.org/viewvc?rev=1174332&view=rev
Log:
useful stuff to work better with java.util.Locale

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java?rev=1174332&r1=1174331&r2=1174332&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java Thu Sep 22
19:23:33 2011
@@ -323,6 +323,47 @@ public final class Lang 
     public static String fromLocale(Locale locale) {
         return new Lang(locale).toString();
     }
+    
+    public static Lang getDefaultLang() {
+      return new Lang(Locale.getDefault());
+    }
+    
+    private static Lang[] available_langs;
+    static {
+      try {
+         Locale[] available_locales = Locale.getAvailableLocales();
+         available_langs = new Lang[available_locales.length];
+         for (int n = 0; n < available_locales.length; n++) 
+           available_langs[n] = new Lang(available_locales[n]);
+      } catch (Throwable t) {}
+    }
+    
+    public static Lang[] getAvailableLangs() {
+      return available_langs;
+    }
+    
+    public static final Lang CANADA = new Lang(Locale.CANADA);
+    public static final Lang CANADA_FRENCH = new Lang(Locale.CANADA_FRENCH);
+    public static final Lang CHINA = new Lang(Locale.CHINA);
+    public static final Lang CHINESE = new Lang(Locale.CHINESE);
+    public static final Lang ENGLISH = new Lang(Locale.ENGLISH);
+    public static final Lang FRENCH = new Lang(Locale.FRENCH);
+    public static final Lang GERMAN = new Lang(Locale.GERMAN);
+    public static final Lang ITALIAN = new Lang(Locale.ITALIAN);
+    public static final Lang JAPANESE = new Lang(Locale.JAPANESE);
+    public static final Lang KOREAN = new Lang(Locale.KOREAN);
+    public static final Lang SIMPLIFIED_CHINESE = new Lang(Locale.SIMPLIFIED_CHINESE);
+    public static final Lang TRADITIONAL_CHINESE = new Lang(Locale.TRADITIONAL_CHINESE);
+    public static final Lang FRANCE = new Lang(Locale.FRANCE);
+    public static final Lang GERMANY = new Lang(Locale.GERMANY);
+    public static final Lang ITALY = new Lang(Locale.ITALY);
+    public static final Lang JAPAN = new Lang(Locale.JAPAN);
+    public static final Lang KOREA = new Lang(Locale.KOREA);
+    public static final Lang PRC = new Lang(Locale.PRC);
+    public static final Lang TAIWAN = new Lang(Locale.TAIWAN);
+    public static final Lang UK = new Lang(Locale.UK);
+    public static final Lang US = new Lang(Locale.US);
+    
 }
 
 



Mime
View raw message