Constructor and Description |
---|
LocaleUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isValidLocale(Locale locale) |
static Locale |
parseFromFilename(String filename,
Locale fallback) |
public static Locale parseFromFilename(String filename, Locale fallback)
language_country_variant
triad commonly found at the end of i18n messages file names.
I.e. given a filename like the following messages_foo_bar_de_CH
it will correctly resolve into a Locale whose language is de
and whose country code is CH
. If the filename contains no Locale information at the expected position, the method will return fallback.
The method is also forgiving when it comes to a lowercase country code and won't throw any exception.
public static boolean isValidLocale(Locale locale)
Copyright © 2003–2017 Magnolia International Ltd.. All rights reserved.