public final class Languages extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Language> |
get()
Language classes are detected at runtime by searching the classpath for files named
META-INF/org/languagetool/language-module.properties. |
static Language |
getLanguageForLocale(Locale locale)
Get the best match for a locale, using American English as the final fallback if nothing
else fits.
|
static Language |
getLanguageForName(String languageName)
Get the Language object for the given language name.
|
static Language |
getLanguageForShortName(String langCode)
Get the Language object for the given short language name.
|
static List<Language> |
getWithDemoLanguage()
Like
get() but the list contains also LanguageTool's internal 'Demo'
language, if available. |
static boolean |
isLanguageSupported(String langCode)
Return whether a language with the given language code is supported.
|
public static List<Language> get()
META-INF/org/languagetool/language-module.properties. Those file(s)
need to contain a key languageClasses which specifies the fully qualified
class name(s), e.g. org.languagetool.language.English. Use commas to specify
more than one class.public static List<Language> getWithDemoLanguage()
get() but the list contains also LanguageTool's internal 'Demo'
language, if available. Only useful for tests.@Nullable public static Language getLanguageForName(String languageName)
languageName - e.g. English or German (case is significant)null if there is no such languagepublic static Language getLanguageForShortName(String langCode)
langCode - e.g. en or es-USIllegalArgumentException - if the language is not supported or if the language code is invalidpublic static boolean isLanguageSupported(String langCode)
Language object is initialized.langCode - e.g. en or en-USIllegalArgumentException - in some cases of an invalid language code formatpublic static Language getLanguageForLocale(Locale locale)
RuntimeException - if no language was found and American English as a fallback is not available