mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-05 17:45:52 +01:00
Add support for more BCP combinations
- region, variant, script & language combined - 2 char language, 2 char region - 2 char lang, 4 char script, 3 char variant
This commit is contained in:
parent
da347b22ba
commit
dc02abcf51
@ -377,7 +377,9 @@ public class ResConfigFlags {
|
||||
// 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')) {
|
||||
(language.length == 3 && region.length == 2 && region[0] != '\00' &&
|
||||
localeScript.length == 0 && localeVariant.length == 0)) {
|
||||
|
||||
sb.append("-").append(language);
|
||||
if (region[0] != '\00') {
|
||||
sb.append("-r").append(region);
|
||||
@ -390,16 +392,13 @@ public class ResConfigFlags {
|
||||
if (language[0] != '\00') {
|
||||
sb.append(language);
|
||||
}
|
||||
if (localeScript.length == 4 && region.length == 2) {
|
||||
sb.append("+").append(localeScript).append("+").append(region);
|
||||
if (localeScript.length == 4) {
|
||||
sb.append("+").append(localeScript);
|
||||
}
|
||||
if (region.length == 3) {
|
||||
if ((region.length == 2 || region.length == 3) && region[0] != '\00') {
|
||||
sb.append("+").append(region);
|
||||
}
|
||||
if (localeVariant.length >= 5) {
|
||||
if (region.length == 2) {
|
||||
sb.append("+").append(region);
|
||||
}
|
||||
sb.append("+").append(toUpper(localeVariant));
|
||||
}
|
||||
}
|
||||
|
@ -202,11 +202,26 @@ public class BuildAndDecodeTest {
|
||||
compareValuesFiles("values-b+ast/strings.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void twoLetterLangBcp47Test() throws BrutException, IOException {
|
||||
compareValuesFiles("values-en-rUS/strings.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void variantBcp47Test() throws BrutException, IOException {
|
||||
compareValuesFiles("values-b+en+US+POSIX/strings.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fourpartBcp47Test() throws BrutException, IOException {
|
||||
compareValuesFiles("values-b+ast+Latn+IT+AREVELA/strings.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void RegionLocaleBcp47Test() throws BrutException, IOException {
|
||||
compareValuesFiles("values-b+en+Latn+419/strings.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void numericalRegionBcp47Test() throws BrutException, IOException {
|
||||
compareValuesFiles("values-b+eng+419/strings.xml");
|
||||
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="test1">test1</string>
|
||||
</resources>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="test1">test1</string>
|
||||
</resources>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="test1">test1</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user