01: /*
02: * Created on 1 Nov 2006
03: */
04: package uk.org.ponder.localeutil;
05:
06: import java.util.Locale;
07:
08: /** Utilities for dealing with Locales.
09: *
10: * @author Antranig Basman (antranig@caret.cam.ac.uk)
11: *
12: */
13:
14: public class LocaleUtil {
15: public static Locale parseLocale(String localestring) {
16: String[] locValues = localestring.trim().split("_");
17: if (locValues.length == 1) {
18: return new Locale(locValues[0]);
19: } else if (locValues.length == 2) {
20: return new Locale(locValues[0], locValues[1]);
21: } else {
22: return new Locale(locValues[0], locValues[1], locValues[2]);
23: }
24: }
25: }
|