mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-23 21:57:34 +01:00
fix(YouTube - Spoof video streams): Use 2 letter device language code
This commit is contained in:
parent
b87d995587
commit
33ff997200
@ -2,6 +2,8 @@ package app.revanced.extension.shared.spoof;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ final class PlayerRoutes {
|
||||
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);
|
||||
|
@ -38,8 +38,6 @@
|
||||
<item>@string/revanced_spoof_video_streams_language_OR</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_PA</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_PL</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_PT_BR</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_PT_PT</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_RO</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_RU</item>
|
||||
<item>@string/revanced_spoof_video_streams_language_SK</item>
|
||||
@ -93,8 +91,6 @@
|
||||
<item>OR</item>
|
||||
<item>PA</item>
|
||||
<item>PL</item>
|
||||
<item>PT_BR</item>
|
||||
<item>PT_PT</item>
|
||||
<item>RO</item>
|
||||
<item>RU</item>
|
||||
<item>SK</item>
|
||||
|
@ -1338,8 +1338,6 @@ Video playback may not work"</string>
|
||||
<string name="revanced_spoof_video_streams_language_OR">Odia</string>
|
||||
<string name="revanced_spoof_video_streams_language_PA">Punjabi</string>
|
||||
<string name="revanced_spoof_video_streams_language_PL">Polish</string>
|
||||
<string name="revanced_spoof_video_streams_language_PT_BR">Portuguese (Brazil)</string>
|
||||
<string name="revanced_spoof_video_streams_language_PT_PT">Portuguese (Portugal)</string>
|
||||
<string name="revanced_spoof_video_streams_language_RO">Romanian</string>
|
||||
<string name="revanced_spoof_video_streams_language_RU">Russian</string>
|
||||
<string name="revanced_spoof_video_streams_language_SK">Slovak</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user