Skip to content

Commit d90950d

Browse files
committed
fix(irish): use the standard sampleTexts path for default example text
Every other language gets its example text from the sampleTexts map in dynamic_meta.js, applied by updateMeta(). Irish was never added there, so updateMeta() assigned sampleTexts["Irish"] === undefined to the textarea. The previous workaround added a separate DEFAULT_EXAMPLE_TEXT map in main.js, but it ran before updateMeta() in the same handler, so updateMeta() overwrote it moments later. It also gated on localStorage rather than the textarea, so it could not repopulate an emptied form. Fix the data instead of working around it: - Add Irish to sampleTexts (an Irish passage about the IPA, matching the theme of the other languages' samples). - Add Irish to translatedMeta so the meta description no longer renders "undefined" for Irish. - Remove the DEFAULT_EXAMPLE_TEXT block from main.js. Verified in a real browser (Playwright): Irish shows its sample on first load and again after clearing the form and reselecting the language; German is unaffected. Full e2e suite: 21 passed, 5 skipped. Golden: 81 pass.
1 parent 9e5a6bc commit d90950d

2 files changed

Lines changed: 5 additions & 14 deletions

File tree

wiktionary_pron/scripts/dynamic_meta.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const translatedMeta = {
3030
"Ελληνικά σε IPA: Online μετατροπέας και γεννήτρια φωνητικής μεταγραφής. Μετατρέψτε ελληνικό κείμενο σε φωνημική μεταγραφή.",
3131
Icelandic:
3232
"Íslenska yfir í IPA: Hljóðritunarbreytir og rafall á netinu. Breyttu texta í hljóðfræðilega umritun.",
33+
Irish:
34+
"Gaeilge go IPA: Gineadóir agus tiontaire tras-scríbhneoireachta foghraíochta ar líne. Tiontaigh téacs Gaeilge go tras-scríbhinn fhóinéimeach.",
3335

3436
// --- Languages with ONLY Phonetic ---
3537
Russian:
@@ -58,6 +60,7 @@ Esta transcrição normalmente se aproxima de maneira padrão de pronunciar dete
5860
Lithuanian: `Tarptautinė fonetinė abėcėlė arba TFA – abėcėlinė fonetinio žymėjimo sistema, paremta lotynų abėcėle. Ją sukūrė Tarptautinė fonetikos asociacija, siekdama sunorminti įvairių kalbų garsų užrašymą. Tarptautinę fonetinę abėcėlę naudoja leksikografai, žmonės, kurie moko(si) užsienio kalbų, lingvistai, kalbos ir kalbėsenos patologai, dainininkai, aktoriai, dirbtinių kalbų kūrėjai bei vertėjai.`,
5961
Icelandic: `Með alþjóðlega hljóðstafrófinu er leitast við að lýsa áþreifanlegum eiginleikum mælts máls, þá hljóðönum, hljómfalli og niðurgreiningu í orð og atkvæði. Því eru þó takmörk sett þegar kemur að smæstu smáatriðum, en reynt hefur verið að auka á notagildi þess með viðbótartáknum.
6062
Þau grunntákn sem stuðst er við í alþjóðlega hljóðstafrófinu eru stafir og sérmerki. Hægt er að hljóðrita af mismikilli nákvæmni og stöðugt er unnið að því að bæta nákvæmni stafrófsins. Alþjóðlega hljóðfræðifélagið bætir við, fjarlægir og breytir táknum eftir þörf. Núorðið eru stafirnir alls 107, sérmerkin 52 og hljómfallstákn fjögur í stafrófinu.`,
63+
Irish: `Is córas nodaireachta é an Aibítir Fhoghraíochta Idirnáisiúnta a chruthaigh teangeolaithe chun fuaimeanna na gcanúintí go léir a scríobh síos go cruinn. Baintear úsáid as chun foghraíocht na Gaeilge a léiriú, agus na trí phríomhchanúint san áireamh: Connachta, an Mhumhain agus Ulaidh. Tá difríochtaí móra idir na canúintí ó thaobh na ngutaí agus na gconsan caol agus leathan de.`,
6164
};
6265

6366
function updateMeta(selectedLanguage) {

wiktionary_pron/scripts/main.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -680,18 +680,6 @@ async function updateOptionsUponLanguageSelection(event) {
680680

681681
enableAll();
682682
loadedLanguages[selectedLanguage] = true;
683-
684-
// Language-specific default example text (data-driven, extensible)
685-
const DEFAULT_EXAMPLE_TEXT = {
686-
Irish: "cleachtann mic léinn an aibítir fhoghraíochta idirnáisiúnta go cúramach i gcónaí",
687-
};
688-
const defaultText = DEFAULT_EXAMPLE_TEXT[selectedLanguage];
689-
if (defaultText && !localStorage.getItem("inputText") && !urlParams.get("text")) {
690-
const ta = document.getElementById("text_to_transcribe");
691-
if (ta) { ta.value = defaultText; }
692-
}
693-
694-
695683
}
696684

697685
setLanguageAndFindVoice(lang.ttsCode);
@@ -844,8 +832,8 @@ function rememberText() {
844832
textArea.setAttribute("data-listener-added", "true");
845833
}
846834

847-
// Retrieve text from local storage on page load, or set default per language.
848-
// Check for URL ?text= param inside the lang handler instead (it runs later).
835+
// Restore text from local storage. Runs after updateMeta() has seeded the
836+
// per-language sample text, so a saved draft wins over the sample.
849837
console.log("DOMContentLoaded", localStorage.getItem("inputText"));
850838
const savedText = localStorage.getItem("inputText");
851839
if (savedText) {

0 commit comments

Comments
 (0)