Returns whether a locale, given as a string in the ICU syntax, is RTL.
432558
public static boolean isRtlLanguage(String locale) {
    try {
      return UScript.isRightToLeft(
          UCharacter.getPropertyValueEnum(
              UProperty.SCRIPT, ULocale.addLikelySubtags(new ULocale(locale)).getScript()));
    } catch (IllegalArgumentException e) {
      return false;
    }
  }
1044935
def get_language(pType)
      pType.downcase!
      return Languages::RubySyntax.new if pType == 'ruby'
      # if pType == "python"
      #   raise Error::LanguageError
      # end
      # if pType == "vhdl"
      #   raise Error::LanguageError
      # end
      # if pType == "c"
      #   raise Error::LanguageError
      # end
      # if pType == "cplusplus"
      #   raise Error::LanguageError
      # end
      # if pType == "java"
      #   raise Error::LanguageError
      # end
      # if pType == "assemblyarm"
      #   raise Error::LanguageError
      # end
      # if pType == "php"
      #   raise Error::LanguageError

      raise Error::LanguageError
    end
1274469
public String getDisplayCountry(Locale locale) {
        String countryCode = baseLocale.getRegion();
        if (countryCode.isEmpty()) {
            return "";
        }

        final String normalizedRegion = normalizeAndValidateRegion(
                countryCode, false /* strict */);
        if (normalizedRegion.isEmpty()) {
            return countryCode;
        }

        String result = ICU.getDisplayCountry(this, locale);
        if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
            result = ICU.getDisplayCountry(this, Locale.getDefault());
        }
        return result;
    }
1195212
static int subSequenceEquals(
        CharSequence test,
        int offset,
        CharSequence expected,
        boolean caseInsensitive,
        boolean rtl
    ) {

        int j = 0;
        int max = test.length();
        int len = expected.length();

        for (int i = 0; i < len; i++) {
            char c = '\u0000';
            char exp = expected.charAt(i);

            if (isBidi(exp)) {
                continue; // always ignore bidis in pattern when parsing
            }

            if (rtl) {
                while ((j + offset < max) && isBidi(c = test.charAt(j + offset))) {
                    j++;
                }
            } else if (j + offset < max) {
                c = test.charAt(j + offset);
            }

            if (j + offset >= max) {
                return -1;
            } else {
                j++;
            }

            if (caseInsensitive) {
                if (!charEqualsIgnoreCase(c, exp)) {
                    return -1;
                }
            } else if (c != exp) {
                return -1;
            }
        }

        if (rtl) {
            while ((j + offset < max) && isBidi(test.charAt(j + offset))) {
                j++;
            }
        }

        return j;

    }
902361
public function isRtl(string $language): bool
    {
        $result = false;

        // Simplify and verify, just in case
        $language = $this->localeToLanguage($language);
        if (in_array($language, $this->getRtl())) {
            $result = true;
        }

        return $result;
    }
630481
public String getLang(final Locale locale, final String key) {
        return langs.get(locale.toString()).getProperty(key);
    }
174696
static boolean isStartOfIcuMessage(String part) {
    // ICU messages start with a '{' followed by an identifier, followed by a ',' and then 'plural'
    // or 'select' follows by another comma.
    // the 'startsWith' check is redundant but should allow us to skip using the matcher
    if (!part.startsWith("{")) {
      return false;
    }
    int commaIndex = part.indexOf(',', 1);
    // if commaIndex == 1 that means the identifier is empty, which isn't allowed.
    if (commaIndex <= 1) {
      return false;
    }
    int nextBracketIndex = part.indexOf('{', 1);
    return (nextBracketIndex == -1 || nextBracketIndex > commaIndex)
        && (part.startsWith("plural,", commaIndex + 1)
            || part.startsWith("select,", commaIndex + 1));
  }
898352
public static boolean isCJK(String str, int beginIndex, int endIndex)
    {
        for ( int j = beginIndex; j < endIndex; j++ ) {
            if ( ! isCJKChar(str.charAt(j)) ) {
                return false;
            }
        }

        return true;
    }
512694
function (newCode) {
        if (newCode) {
          code = newCode;
          this.rtl = this.data[newCode] ? this.data[newCode]._dir === 'rtl' : false;
        }
      }
1225226
function getLocalizedLabel(locale) {
        var key  = "LOCALE_" + locale.toUpperCase().replace("-", "_"),
            i18n = Strings[key];

        return i18n === undefined ? locale : i18n;
    }
794179
public boolean isMarkedNoTranslation(Locale locale) {

        if (m_noTranslation != null) {
            return CmsLocaleManager.getLocales(m_noTranslation).contains(locale);
        }
        return false;
    }
716330
function get() {
      var offset = this.offset;
      var translate = this.translate;

      if (Components.Direction.is('rtl')) {
        return translate + offset;
      }

      return translate - offset;
    }
1036083
private int parseLanguage() {
        int startLength = buffer.length();

        if (haveExperimentalLanguagePrefix()) {
            append(AsciiUtil.toLower(id[0]));
            append(HYPHEN);
            index = 2;
        }

        char c;
        while(!isTerminatorOrIDSeparator(c = next())) {
            append(AsciiUtil.toLower(c));
        }
        --index; // unget

        if (buffer.length() - startLength == 3) {
            String lang = LocaleIDs.threeToTwoLetterLanguage(getString(0));
            if (lang != null) {
                set(0, lang);
            }
        }

        return 0;
    }
1099955
function Rtl (Glide, Components) {
  return {
    /**
     * Negates the passed translate if glide is in RTL option.
     *
     * @param  {Number} translate
     * @return {Number}
     */
    modify: function modify(translate) {
      if (Components.Direction.is('rtl')) {
        return -translate;
      }

      return translate;
    }
  };
}
1101353
def detect_language(index_page):
    
    dom = dhtmlparser.parseString(index_page)

    clean_content = dhtmlparser.removeTags(dom)

    lang = None
    try:
        lang = langdetect.detect(clean_content)
    except UnicodeDecodeError:
        lang = langdetect.detect(clean_content.decode("utf-8"))

    return SourceString(
        lang,
        source="langdetect"
    )
1256018
private String getConcatenationPattern(ULocale locale) {
        ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
        ICUResourceBundle dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns");
        ICUResourceBundle concatenationPatternRb = (ICUResourceBundle) dtPatternsRb.get(8);
        if (concatenationPatternRb.getType() == UResourceBundle.STRING) {
            return concatenationPatternRb.getString();
        } else {
            return concatenationPatternRb.getString(0);
        }
    }
1041785
def check_i18n():
    
    while True:
        try:
            token_type, text, _, _, line = yield
        except GeneratorExit:
            return

        if text == "def" and token_type == tokenize.NAME:
            # explicitly ignore function definitions, as oslo defines these
            return
        if (token_type == tokenize.NAME and
                text in ["_", "_LI", "_LW", "_LE", "_LC"]):

            while True:
                token_type, text, start, _, _ = yield
                if token_type != tokenize.NL:
                    break
            if token_type != tokenize.OP or text != "(":
                continue  # not a localization call

            format_string = ''
            while True:
                token_type, text, start, _, _ = yield
                if token_type == tokenize.STRING:
                    format_string += eval(text)
                elif token_type == tokenize.NL:
                    pass
                else:
                    break

            if not format_string:
                raise LocalizationError(
                    start, "H701: Empty localization string")
            if token_type != tokenize.OP:
                raise LocalizationError(
                    start, "H701: Invalid localization call")
            if text != ")":
                if text == "%":
                    raise LocalizationError(
                        start,
                        "H702: Formatting operation should be outside"
                        " of localization method call")
                elif text == "+":
                    raise LocalizationError(
                        start,
                        "H702: Use bare string concatenation instead of +")
                else:
                    raise LocalizationError(
                        start, "H702: Argument to _, _LI, _LW, _LC, or _LE "
                        "must be just a string")

            format_specs = FORMAT_RE.findall(format_string)
            positional_specs = [(key, spec) for key, spec in format_specs
                                if not key and spec]
            # not spec means %%, key means %(smth)s
            if len(positional_specs) > 1:
                raise LocalizationError(
                    start, "H703: Multiple positional placeholders")