show both English and native language names in translation dropdown

This commit is contained in:
Russell Ballestrini 2025-07-12 11:01:00 -04:00
parent 7851c5747c
commit e87e27b2a2

View file

@ -2,7 +2,7 @@
import { initializeChunkFiveFont } from "./ui-themes.js";
import { getUIText } from "./ui-translations.js";
import { extractWebpageContent } from "./content.js";
import { translateCurrentPage, translateText, translateHTML, SUPPORTED_LANGUAGES } from "./translation.js";
import { translateCurrentPage, translateText, translateHTML, SUPPORTED_LANGUAGES, NATIVE_LANGUAGE_NAMES } from "./translation.js";
// Function to fetch full HTML content from a remote URL using CORS proxy
async function fetchRemotePageHTML(url) {
@ -219,7 +219,9 @@ export function openTranslateModal() {
Object.entries(SUPPORTED_LANGUAGES).forEach(([code, name]) => {
const option = document.createElement("option");
option.value = code;
option.textContent = name;
const nativeName = NATIVE_LANGUAGE_NAMES[code];
// Show both English and native names, unless they're the same
option.textContent = nativeName && nativeName !== name ? `${name} - ${nativeName}` : name;
languageSelect.appendChild(option);
});