Add preferred language option (closes #1)

This commit is contained in:
shirt 2022-04-24 22:59:51 -04:00
parent 5ac499f5cf
commit a793273c04
5 changed files with 66 additions and 2 deletions

View file

@ -105,6 +105,11 @@ function get_profile_list() {
return custom_profiles;
}
// eslint-disable-next-line no-unused-vars
function get_preferred_locale() {
return globalOptions.preferredLocale;
}
do_patch(
"Hello world",
/(.*)/,
@ -136,5 +141,17 @@ if (globalOptions.showAllTracks) {
);
}
do_patch(
"Set preferred audio locale",
/preferredAudioLocale:.\.preferredAudioLocale/,
"preferredAudioLocale: get_preferred_locale()"
);
do_patch(
"Set preferred text locale",
/preferredTextLocale:.\.preferredTextLocale/,
"preferredTextLocale: get_preferred_locale()"
);
// run our patched copy of playercore in a non-privileged context on the page
window.Function(cadmium_src)();