pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util
Class LocaleUtils

java.lang.Object
  extended by org.torweg.pulse.util.LocaleUtils

public final class LocaleUtils
extends java.lang.Object

utility methods for working with Locales.

Version:
$Revision: 1405 $
Author:
Thomas Weber

Nested Class Summary
static class LocaleUtils.LocaleComparator
          Comparator comparing locales by their String representations.
 
Method Summary
static java.util.Locale localeFromString(java.lang.String l)
          builds a Locale from the String returned by Locale.toString().
static boolean matches(java.util.Locale source, java.util.Locale target)
          matches the source Locale to the target Locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

localeFromString

public static java.util.Locale localeFromString(java.lang.String l)
builds a Locale from the String returned by Locale.toString().

Parameters:
l - the locale string
Returns:
the Locale or null, if no Locale could be built from the given String

matches

public static boolean matches(java.util.Locale source,
                              java.util.Locale target)
matches the source Locale to the target Locale.

The source matches the target, if it is a subset of the target's attributes.

Parameters:
source - the locale to check
target - the locale to check against.
Returns:
true, if the locale matches the given language, country and variant