Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 13 package org.pentaho.messages.util; 14 15 import java.util.Locale ; 16 17 public class LocaleHelper { 18 19 private static final ThreadLocal threadLocales = new ThreadLocal (); 20 21 private static Locale defaultLocale; 22 23 private static String ENCODING = "UTF-8"; 25 private static String TEXT_DIRECTION = "LTR"; 27 public static void setDefaultLocale(Locale newLocale) { 28 defaultLocale = newLocale; 29 } 30 31 public static Locale getDefaultLocale() { 32 return defaultLocale; 33 } 34 35 public static void setLocale(Locale newLocale) { 36 threadLocales.set(newLocale); 37 } 38 39 public static Locale getLocale() { 40 Locale rtn = (Locale ) threadLocales.get(); 41 if (rtn != null) { 42 return rtn; 43 } 44 defaultLocale = Locale.getDefault(); 45 setLocale(defaultLocale); 46 return defaultLocale; 47 } 48 49 public static void setSystemEncoding(String encoding) { 50 ENCODING = encoding; 51 } 52 53 public static void setTextDirection(String textDirection) { 54 TEXT_DIRECTION = textDirection; 56 } 57 58 public static String getSystemEncoding() { 59 return ENCODING; 60 } 61 62 public static String getTextDirection() { 63 return TEXT_DIRECTION; 65 } 66 67 } 68
| Popular Tags
|