Code example for Splitter

Methods: split

			// For some reason the locale set can contain more than one element, 
			// we just take the first one. 
			String code = locales.iterator().next();
			Locale locale = null;
			List<String> localeSplits = ImmutableList.copyOf(LOCALE_SPLITTER.split(code));
			switch (localeSplits.size()) {
			case 1: locale = new Locale(localeSplits.get(0)); break;
			case 2: locale = new Locale(localeSplits.get(0), localeSplits.get(1)); break;
			case 3: locale = new Locale(localeSplits.get(0), localeSplits.get(1), localeSplits.get(2)); break;
			if (locale != null && locale.toString().length() > 0) {
				return locale;
		// Otherwise we guess the locale on the basis of the concrete language name. 
		// We assume that the name contains the language information in the last 3 chars. 
		// If this 3-letter sequence is not found in our map, then we assume it is 
		// a 3-letter ISO language code (capitalized).