generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube - Spoof video streams): Allow picking a default audio la…
…nguage track (#4050)
- Loading branch information
1 parent
fd7db2f
commit ede666b
Showing
7 changed files
with
328 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...shared/library/src/main/java/app/revanced/extension/shared/spoof/AudioStreamLanguage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package app.revanced.extension.shared.spoof; | ||
|
||
import java.util.Locale; | ||
|
||
public enum AudioStreamLanguage { | ||
DEFAULT, | ||
|
||
// Language codes found in locale_config.xml | ||
// Region specific variants of Chinese/English/Spanish/French have been removed. | ||
AF, | ||
AM, | ||
AR, | ||
AS, | ||
AZ, | ||
BE, | ||
BG, | ||
BN, | ||
BS, | ||
CA, | ||
CS, | ||
DA, | ||
DE, | ||
EL, | ||
EN, | ||
ES, | ||
ET, | ||
EU, | ||
FA, | ||
FI, | ||
FR, | ||
GL, | ||
GU, | ||
HI, | ||
HE, // App uses obsolete 'IW' and 'HE' is modern ISO code. | ||
HR, | ||
HU, | ||
HY, | ||
ID, | ||
IS, | ||
IT, | ||
JA, | ||
KA, | ||
KK, | ||
KM, | ||
KN, | ||
KO, | ||
KY, | ||
LO, | ||
LT, | ||
LV, | ||
MK, | ||
ML, | ||
MN, | ||
MR, | ||
MS, | ||
MY, | ||
NE, | ||
NL, | ||
NB, | ||
OR, | ||
PA, | ||
PL, | ||
PT_BR, | ||
PT_PT, | ||
RO, | ||
RU, | ||
SI, | ||
SK, | ||
SL, | ||
SQ, | ||
SR, | ||
SV, | ||
SW, | ||
TA, | ||
TE, | ||
TH, | ||
TL, | ||
TR, | ||
UK, | ||
UR, | ||
UZ, | ||
VI, | ||
ZH, | ||
ZU; | ||
|
||
private final String iso639_1; | ||
|
||
AudioStreamLanguage() { | ||
iso639_1 = name().replace('_', '-'); | ||
} | ||
|
||
public String getIso639_1() { | ||
// 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) { | ||
// Android VR requires uppercase language code. | ||
return Locale.getDefault().toLanguageTag().toUpperCase(Locale.US); | ||
} | ||
|
||
return iso639_1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.