Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Dec 6, 2024
1 parent 1b9196f commit 9b03d10
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package app.revanced.extension.youtube.patches.spoof;

import android.content.res.Configuration;

import java.util.Locale;

import app.revanced.extension.shared.Utils;

public enum AudioStreamLanguage {
DEFAULT,

Expand Down Expand Up @@ -87,21 +83,18 @@ public enum AudioStreamLanguage {
ZH,
ZU;

private static final Configuration CONFIGURATION = Utils.getContext()
.getResources().getConfiguration();

private final String iso639_1;

AudioStreamLanguage() {
iso639_1 = this.name().replace('_', '-');
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 CONFIGURATION.locale.getLanguage().toUpperCase(Locale.US);
return Locale.getDefault().toLanguageTag().toUpperCase(Locale.US);
}

return iso639_1;
Expand Down

0 comments on commit 9b03d10

Please sign in to comment.