From e87e27b2a209765ca89308268a96da7a235d57d5 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sat, 12 Jul 2025 11:01:00 -0400 Subject: [PATCH] show both English and native language names in translation dropdown --- src/translate-modal.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/translate-modal.js b/src/translate-modal.js index d03845e..db68c0d 100644 --- a/src/translate-modal.js +++ b/src/translate-modal.js @@ -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); });