Tabnine Logo
LanguageUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
LanguageUtils
in
org.tinymediamanager.scraper.util

Best Java code snippets using org.tinymediamanager.scraper.util.LanguageUtils (Showing top 14 results out of 315)

origin: org.tinymediamanager/api-scraper

/**
 * tries to get local (JVM language) COUNTRY name for given parameters/variants
 * 
 * @param countries
 *          all possible names or iso codes
 * @return localized country name, or first country param 1:1 if we cannot translate
 */
public static String getLocalizedCountry(String... countries) {
 return getLocalizedCountryForLanguage(Locale.getDefault().getLanguage(), countries);
}
origin: tinyMediaManager/tinyMediaManager

switch (style) {
 case ISO2:
  return LanguageUtils.getIso2LanguageFromLocalizedString(language);
  return LanguageUtils.getIso3LanguageFromLocalizedString(language);
  return LanguageUtils.getIso3BLanguageFromLocalizedString(language);
  return LanguageUtils.getEnglishLanguageNameFromLocalizedString(language);
  return LanguageUtils.getLocalizedLanguageNameFromLocalizedString(language);
origin: org.tinymediamanager/api-scraper

/**
 * Get the ISO 639-2/B 3 letter code
 * 
 * @param language
 *          the 2 letter ISO code to get the 3 letter code for
 * @return the 3 letter code
 * @since 2.0
 */
public static String getISO3BLanguage(String language) {
 return getISO3BLanguage(Locale.forLanguageTag(language));
}
origin: org.tinymediamanager.plugins/scraper-imdb

if (ImdbMetadataProvider.providerInfo.getConfig().getValueAsBool("scrapeLanguageNames")) {
 md.addCountry(
   LanguageUtils.getLocalizedCountryForLanguage(options.getLanguage().getLanguage(), countryElement.text(), matcher.group(1)));
if (ImdbMetadataProvider.providerInfo.getConfig().getValueAsBool("scrapeLanguageNames")) {
 md.addSpokenLanguage(
   LanguageUtils.getLocalizedLanguageNameFromLocalizedString(options.getLanguage(), languageElement.text(), matcher.group(1)));
origin: org.tinymediamanager/api-scraper

/**
 * uses our localized language mapping table, to get the localized language name
 *
 * @param text
 *          the language (as string) to get the language name for
 * @return the localized language name or the untranslated string 1:1
 * @since 2.0
 */
public static String getLocalizedLanguageNameFromLocalizedString(String text) {
 return getLocalizedLanguageNameFromLocalizedString(Locale.getDefault(), text);
}
origin: tinyMediaManager/tinyMediaManager

private String parseLanguageFromString(String shortname) {
 if (StringUtils.isBlank(shortname)) {
  return "";
 }
 Set<String> langArray = LanguageUtils.KEY_TO_LOCALE_MAP.keySet();
 shortname = shortname.replaceAll("(?i)Part [Ii]+", ""); // hardcoded; remove Part II which is no stacking marker; b/c II is a valid iso code :p
 shortname = StringUtils.split(shortname, '/')[0].trim(); // possibly "de / de" - just take first
 for (String s : langArray) {
  try {
   if (shortname.equalsIgnoreCase(s) || shortname.matches("(?i).*[ _.-]+" + Pattern.quote(s) + "$")) {// ends with lang + delimiter prefix
    LOGGER.debug("found language '" + s + "' in '" + this.getFilename());
    return LanguageUtils.getIso3LanguageFromLocalizedString(s);
   }
  }
  catch (Exception e) {
   LOGGER.warn("Error parsing subtitle language from locale keyset: " + s, e);
  }
 }
 return "";
}
origin: tinyMediaManager/tinyMediaManager

for (String langu : mp.language.split("\\|")) {
 langu = langu.trim();
 String languIso = LanguageUtils.getIso2LanguageFromLocalizedString(langu);
 if (StringUtils.isNotBlank(languIso)) {
  languages.add(languIso);
origin: org.tinymediamanager.plugins/scraper-tmdb

md.addSpokenLanguage(LanguageUtils.getLocalizedLanguageNameFromLocalizedString(options.getLanguage(), lang.name, lang.iso_639_1));
md.addCountry(LanguageUtils.getLocalizedCountryForLanguage(options.getLanguage(), country.name, country.iso_3166_1));
origin: tinyMediaManager/tinyMediaManager

sub.setLanguage(LanguageUtils.getIso3LanguageFromLocalizedString(lang));
break;
origin: org.tinymediamanager/api-scraper

/**
 * tries to get localized COUNTRY name (in given language) for given parameters/variants
 * 
 * @param countries
 *          all possible names or iso codes
 * @return localized country name, or first country param 1:1 if we cannot translate
 */
public static String getLocalizedCountryForLanguage(String language, String... countries) {
 // KEY_TO_LOCALE_MAP is correct here, we want to get the language locale!!!
 return getLocalizedCountryForLanguage(KEY_TO_LOCALE_MAP.get(language.toLowerCase(Locale.ROOT)), countries);
}
origin: org.tinymediamanager/api-scraper

/**
 * uses our localized language mapping table, to get the iso3B code
 *
 * @param text
 *          the language (as string) to get the iso3B code for
 * @return 3 chars or empty string
 * @since 2.0
 */
public static String getIso3BLanguageFromLocalizedString(String text) {
 Locale l = KEY_TO_LOCALE_MAP.get(text.toLowerCase(Locale.ROOT));
 if (l != null) {
  return getISO3BLanguage(l);
 }
 return "";
}
origin: org.tinymediamanager.plugins/scraper-moviemeter

md.addCountry(LanguageUtils.getLocalizedCountryForLanguage(options.getLanguage(), country));
origin: org.tinymediamanager.plugins/scraper-opensubtitles

/**
 * opensubtitles need sometimes not ISO 639.2B - this method maps the exceptions
 *
 * @param locale
 *          the language top be converted
 * @return the string accepted by opensubtitles
 */
private String getLanguageCode(Locale locale) {
 // default ISO 639.2B
 String languageCode = LanguageUtils.getISO3BLanguage(locale.getLanguage());
 // and now the exceptions
 // greek: gre -> ell
 if ("gre".equals(languageCode)) {
  languageCode = "ell";
 }
 return languageCode;
}
origin: org.tinymediamanager/api-scraper

langArray.put(LanguageUtils.getISO3BLanguage(base), base);
org.tinymediamanager.scraper.utilLanguageUtils

Javadoc

This is a helper class for language related tasks

Most used methods

  • getLocalizedCountryForLanguage
    tries to get localized COUNTRY name (in given language) for given parameters/variants
  • getLocalizedLanguageNameFromLocalizedString
    uses our localized language mapping table, to get the localized language name in given language
  • getISO3BLanguage
    Get the ISO 639-2/B 3 letter code
  • getEnglishLanguageNameFromLocalizedString
    uses our localized language mapping table, to get the english language name
  • getIso2LanguageFromLocalizedString
    uses our localized language mapping table, to get the iso2 code
  • getIso3BLanguageFromLocalizedString
    uses our localized language mapping table, to get the iso3B code
  • getIso3LanguageFromLocalizedString
    uses our localized language mapping table, to get the iso3 code

Popular in Java

  • Making http requests using okhttp
  • getResourceAsStream (ClassLoader)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now