public final class LanguageInfo extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LanguageInfo.LocaleType
Type of the locale to use
|
| Modifier | Constructor and Description |
|---|---|
private |
LanguageInfo() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getDisplayName(Locale locale)
Replies the display string used by JOSM for a given locale.
|
static String |
getJavaLocaleCode(String localeName)
Replies the locale code used by Java for a given locale.
|
static String |
getJOSMLocaleCode()
Replies the JOSM locale code for the default locale.
|
static String |
getJOSMLocaleCode(Locale locale)
Replies the locale code used by JOSM for a given locale.
|
static String |
getLanguageCodeManifest()
Replies the language prefix for use in manifests (with an underscore appended).
|
static Collection<String> |
getLanguageCodes(Locale l)
Replies a list of language codes for local names.
|
static String |
getLanguageCodeXML()
Replies the language prefix for use in XML elements (with a dot appended).
|
static Locale |
getLocale(String localeName)
Replies the locale used by Java for a given language code.
|
static String |
getWikiLanguagePrefix()
Replies the wiki language prefix for the current locale.
|
static String |
getWikiLanguagePrefix(LanguageInfo.LocaleType type)
Replies the wiki language prefix for the given locale.
|
static boolean |
isBetterLanguage(String oldLanguage,
String newLanguage)
Check if a new language is better than a previous existing.
|
private LanguageInfo()
public static String getWikiLanguagePrefix(LanguageInfo.LocaleType type)
type - the typenull for LanguageInfo.LocaleType.BASELANGUAGE, when
base language is identical to default or englishpublic static String getWikiLanguagePrefix()
Locale.getDefault(),
getWikiLanguagePrefix(LocaleType)public static String getJOSMLocaleCode()
getJOSMLocaleCode(Locale)public static String getJOSMLocaleCode(Locale locale)
Locale.getLanguage()
to identify the locale of a localized resource, but in some cases it may use the
programmatic name for locales, as replied by Locale.toString().
For unknown country codes and variants this function already does fallback to
internally known translations.locale - the locale. Replies "en" if null.public static String getJavaLocaleCode(String localeName)
localeName - the locale. Replies "en" if null.public static String getDisplayName(Locale locale)
Locale.getDisplayName(), for some
locales an override is used (i.e. when unsupported by Java).locale - the locale. Replies "en" if null.public static Locale getLocale(String localeName)
localeName - the locale code.public static boolean isBetterLanguage(String oldLanguage, String newLanguage)
oldLanguage - the language code of the existing stringnewLanguage - the language code of the new stringpublic static String getLanguageCodeXML()
getJOSMLocaleCode()public static String getLanguageCodeManifest()
getJOSMLocaleCode()public static Collection<String> getLanguageCodes(Locale l)
l - the locale to use, null for default locale