diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/AudioStreamLanguage.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/AudioStreamLanguage.java index 566b2379f4..ec9be62adb 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/AudioStreamLanguage.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/AudioStreamLanguage.java @@ -2,6 +2,8 @@ import java.util.Locale; +import app.revanced.extension.shared.Utils; + public enum AudioStreamLanguage { /** * YouTube default. @@ -65,8 +67,6 @@ public enum AudioStreamLanguage { OR, PA, PL, - PT_BR, - PT_PT, RO, RU, SI, @@ -88,26 +88,19 @@ public enum AudioStreamLanguage { ZH, ZU; - private final String iso639_1; + private final String language; AudioStreamLanguage() { - String name = name(); - final int regionSeparatorIndex = name.indexOf('_'); - if (regionSeparatorIndex >= 0) { - iso639_1 = name.substring(0, regionSeparatorIndex).toLowerCase(Locale.US) - + name.substring(regionSeparatorIndex); - } else { - iso639_1 = name().toLowerCase(Locale.US); - } + language = name().toLowerCase(Locale.US); } - public String getIso639_1() { + public String getLanguage() { // Changing the app language does not force the app to completely restart, // so the default needs to be the current language and not a static field. if (this == DEFAULT) { - return Locale.getDefault().toLanguageTag(); + return Locale.getDefault().getLanguage(); } - return iso639_1; + return language; } } diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/PlayerRoutes.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/PlayerRoutes.java index 9832a08a7f..b37daa3cf1 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/PlayerRoutes.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/PlayerRoutes.java @@ -37,7 +37,7 @@ static String createInnertubeBody(ClientType clientType) { JSONObject context = new JSONObject(); JSONObject client = new JSONObject(); - client.put("hl", BaseSettings.SPOOF_VIDEO_STREAMS_LANGUAGE.get().getIso639_1()); + client.put("hl", BaseSettings.SPOOF_VIDEO_STREAMS_LANGUAGE.get().getLanguage()); client.put("clientName", clientType.clientName); client.put("clientVersion", clientType.clientVersion); client.put("deviceModel", clientType.deviceModel); diff --git a/patches/src/main/resources/addresources/values/arrays.xml b/patches/src/main/resources/addresources/values/arrays.xml index e9826de73c..04d95a7d62 100644 --- a/patches/src/main/resources/addresources/values/arrays.xml +++ b/patches/src/main/resources/addresources/values/arrays.xml @@ -38,8 +38,6 @@ @string/revanced_spoof_video_streams_language_OR @string/revanced_spoof_video_streams_language_PA @string/revanced_spoof_video_streams_language_PL - @string/revanced_spoof_video_streams_language_PT_BR - @string/revanced_spoof_video_streams_language_PT_PT @string/revanced_spoof_video_streams_language_RO @string/revanced_spoof_video_streams_language_RU @string/revanced_spoof_video_streams_language_SK @@ -93,8 +91,6 @@ OR PA PL - PT_BR - PT_PT RO RU SK diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index 97de323558..a10b426cee 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -1338,8 +1338,6 @@ Video playback may not work" Odia Punjabi Polish - Portuguese (Brazil) - Portuguese (Portugal) Romanian Russian Slovak