resources/src/main/java/org/robolectric/res/android/ResTable_config.java
String getBcp47Locale(boolean canonicalize) {
    StringBuilder str = new StringBuilder();

    // This represents the "any" locale value, which has traditionally been
    // represented by the empty string.
    if (language[0] == '\0' && country[0] == '\0') {
      return "";
    }

    if (language[0] != '\0') {
      if (canonicalize && areIdentical(language, kTagalog)) {
        // Replace Tagalog with Filipino if we are canonicalizing
        str.setLength(0);
        str.append("fil");// 3-letter code for Filipino
      } else {
        str.append(unpackLanguage());
      }
    }

    if (isTruthy(localeScript[0]) && !localeScriptWasComputed) {
      if (str.length() > 0) {
        str.append('-');
      }
      for (byte aLocaleScript : localeScript) {
        str.append((char) aLocaleScript);
      }
    }

    if (country[0] != '\0') {
      if (str.length() > 0) {
        str.append('-');
      }
      String regionStr = unpackRegion();
      str.append(regionStr);
    }

    if (isTruthy(localeVariant[0])) {
      if (str.length() > 0) {
        str.append('-');
      }

      for (byte aLocaleScript : localeVariant) {
        str.append((char) aLocaleScript);
      }
    }

    // Add Unicode extension only if at least one other locale component is present
    if (localeNumberingSystem[0] != '\0' && str.length() > 0) {
      String NU_PREFIX = "-u-nu-";
      str.append(NU_PREFIX);
      str.append(new String(localeNumberingSystem, UTF_8));
    }

    return str.toString();
  }
String getBcp47Locale(boolean canonicalize) {
    StringBuilder str = new StringBuilder();

    // This represents the "any" locale value, which has traditionally been
    // represented by the empty string.
    if (language[0] == '\0' && country[0] == '\0') {
      return "";
    }

    if (language[0] != '\0') {
      if (canonicalize && areIdentical(language, kTagalog)) {
        // Replace Tagalog with Filipino if we are canonicalizing
        str.setLength(0);
        str.append("fil");// 3-letter code for Filipino
      } else {
        str.append(unpackLanguage());
      }
    }

    if (isTruthy(localeScript[0]) && !localeScriptWasComputed) {
      if (str.length() > 0) {
        str.append('-');
      }
      for (byte aLocaleScript : localeScript) {
        str.append((char) aLocaleScript);
      }
    }

    if (country[0] != '\0') {
      if (str.length() > 0) {
        str.append('-');
      }
      String regionStr = unpackRegion();
      str.append(regionStr);
    }

    if (isTruthy(localeVariant[0])) {
      if (str.length() > 0) {
        str.append('-');
      }

      for (byte aLocaleScript : localeVariant) {
        str.append((char) aLocaleScript);
      }
    }

    // Add Unicode extension only if at least one other locale component is present
    if (localeNumberingSystem[0] != '\0' && str.length() > 0) {
      String NU_PREFIX = "-u-nu-";
      str.append(NU_PREFIX);
      str.append(new String(localeNumberingSystem, UTF_8));
    }

    return str.toString();
  }
void ResTable_config::getBcp47Locale(char str[RESTABLE_MAX_LOCALE_LEN], bool canonicalize) const {