mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-14 00:19:25 +01:00
cleanup messy logic for bcp qualifiers
This commit is contained in:
parent
7f487daaf2
commit
da3b8c710d
@ -114,6 +114,22 @@ public class ResConfigFlags {
|
||||
isInvalid = true;
|
||||
}
|
||||
|
||||
if (localeScript.length != 0) {
|
||||
if (localeScript[0] == '\00') {
|
||||
localeScript = null;
|
||||
}
|
||||
} else {
|
||||
localeScript = null;
|
||||
}
|
||||
|
||||
if (localeVariant.length != 0) {
|
||||
if (localeVariant[0] == '\00') {
|
||||
localeVariant = null;
|
||||
}
|
||||
} else {
|
||||
localeVariant = null;
|
||||
}
|
||||
|
||||
this.mcc = mcc;
|
||||
this.mnc = mnc;
|
||||
this.language = language;
|
||||
@ -375,11 +391,8 @@ public class ResConfigFlags {
|
||||
// check for old style non BCP47 tags
|
||||
// allows values-xx-rXX, values-xx, values-xxx-rXX
|
||||
// denies values-xxx, anything else
|
||||
if (language[0] != '\00' && localeScript.length == 0 && localeVariant.length == 0 &&
|
||||
(region.length != 3 && language.length != 3) ||
|
||||
(language.length == 3 && region.length == 2 && region[0] != '\00' &&
|
||||
localeScript.length == 0 && localeVariant.length == 0)) {
|
||||
|
||||
if (localeVariant == null && localeScript == null && (region[0] != '\00' || language[0] != '\00') &&
|
||||
region.length != 3) {
|
||||
sb.append("-").append(language);
|
||||
if (region[0] != '\00') {
|
||||
sb.append("-r").append(region);
|
||||
@ -392,13 +405,13 @@ public class ResConfigFlags {
|
||||
if (language[0] != '\00') {
|
||||
sb.append(language);
|
||||
}
|
||||
if (localeScript.length == 4) {
|
||||
if (localeScript != null && localeScript.length == 4) {
|
||||
sb.append("+").append(localeScript);
|
||||
}
|
||||
if ((region.length == 2 || region.length == 3) && region[0] != '\00') {
|
||||
sb.append("+").append(region);
|
||||
}
|
||||
if (localeVariant.length >= 5) {
|
||||
if (localeVariant != null && localeVariant.length >= 5) {
|
||||
sb.append("+").append(toUpper(localeVariant));
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class BuildAndDecodeTest {
|
||||
|
||||
@Test
|
||||
public void threeLetterLangBcp47Test() throws BrutException, IOException {
|
||||
compareValuesFiles("values-b+ast/strings.xml");
|
||||
compareValuesFiles("values-ast/strings.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user