Merge branch 'MDL-86109-500' of https://github.com/stevandoMoodle/moodle into MOODLE_500_STABLE
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -385,22 +385,15 @@ export class EmbedPreview extends MediaBase {
|
||||
langTracks.forEach((dropdown) => {
|
||||
const defaultVal = dropdown.getAttribute('data-value');
|
||||
if (defaultVal) {
|
||||
// ISO 639-1: 2-letter codes (e.g., en for English, fr for French).
|
||||
// Most widely used in applications like web development (lang="en" in HTML).
|
||||
// Let's check if the value of srclang is language code or language name.
|
||||
if (defaultVal.length === 2) {
|
||||
const options = dropdown.options;
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
if (options[i].dataset.languageCode === defaultVal) {
|
||||
dropdown.value = options[i].value;
|
||||
break;
|
||||
}
|
||||
Array.from(dropdown.options).some(option => {
|
||||
// Check if srclang in track is a language code like "en"
|
||||
// or language name like "English" prior to MDL-85159.
|
||||
if (option.dataset.languageCode === defaultVal || option.value === defaultVal) {
|
||||
option.selected = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// It means the value of srclang in track is a full language name like "English (en)",
|
||||
// which has been like this before this patch.
|
||||
dropdown.value = defaultVal;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user