diff --git a/crates/proof/src/cs/mod.rs b/crates/proof/src/cs/mod.rs index af743406d..c2ec00c9a 100644 --- a/crates/proof/src/cs/mod.rs +++ b/crates/proof/src/cs/mod.rs @@ -42,10 +42,11 @@ pub fn dictionary() -> Arc { fn load_installed() -> AffixDict { let Some((aff, dic)) = crate::hunspell::find(NAMES) else { + crate::hunspell::clear_load_error(NAMES[0]); log::info!("Czech spelling: no Hunspell cs_CZ dictionary installed"); return AffixDict::default(); }; - crate::hunspell::load(&aff, &dic).unwrap_or_else(|e| { + crate::hunspell::note_load(NAMES[0], &dic, crate::hunspell::load(&aff, &dic)).unwrap_or_else(|e| { log::warn!("Czech spelling: {e}"); AffixDict::default() }) diff --git a/crates/proof/src/lib.rs b/crates/proof/src/lib.rs index 6e17a6921..71f96827b 100644 --- a/crates/proof/src/lib.rs +++ b/crates/proof/src/lib.rs @@ -395,16 +395,13 @@ pub fn has_dictionary(lang: Option<&str>) -> bool { ProofLang::from_tag(lang).is_proofed() } -/// The Hunspell dictionary name (`pl_PL`, `pt_BR`) a proofing language needs but doesn't have +/// The Hunspell dictionary name (`pl_PL`, `it_IT`) a proofing language needs but doesn't have /// installed, for a status-bar hint (#1167). `None` when the language's dictionary is available, /// or when it needs none (English has a built-in word list; unproofed languages aren't offered /// one). Reads the dictionary once (it is cached afterwards). pub fn missing_dictionary(lang: Option<&str>) -> Option<&'static str> { - match ProofLang::from_tag(lang) { - ProofLang::Pl => dictionary_needed(ProofLang::Pl, pl::has_dictionary()), - ProofLang::Pt => dictionary_needed(ProofLang::Pt, pt::has_dictionary()), - _ => None, - } + let lang = ProofLang::from_tag(lang); + dictionary_needed(lang, dictionary_loaded(lang)?) } /// The Hunspell name, `.dic` file and reason of a dictionary that is installed for this language @@ -412,24 +409,38 @@ pub fn missing_dictionary(lang: Option<&str>) -> Option<&'static str> { /// loaded, or when no file exists (then [`missing_dictionary`] names it). Reads the dictionary /// once (it is cached afterwards). pub fn unreadable_dictionary(lang: Option<&str>) -> Option<(&'static str, std::path::PathBuf, String)> { - let (proof_lang, loaded) = match ProofLang::from_tag(lang) { - ProofLang::Pl => (ProofLang::Pl, pl::has_dictionary()), - ProofLang::Pt => (ProofLang::Pt, pt::has_dictionary()), - _ => return None, - }; - let name = dictionary_needed(proof_lang, false)?; - if loaded { - return None; - } + let lang = ProofLang::from_tag(lang); + let name = dictionary_needed(lang, dictionary_loaded(lang)?)?; hunspell::load_error(name).map(|(file, reason)| (name, file, reason)) } -/// The Hunspell name `lang` needs when `installed` is false; only Polish and Portuguese use one. +/// Did the Hunspell dictionary of `lang` load? `None` for languages that use none (English). +fn dictionary_loaded(lang: ProofLang) -> Option { + Some(match lang { + ProofLang::Pl => pl::has_dictionary(), + ProofLang::Pt => pt::has_dictionary(), + ProofLang::It => it::has_dictionary(), + ProofLang::Hr => hr::has_dictionary(), + ProofLang::Tr => tr::has_dictionary(), + ProofLang::Ru => ru::has_dictionary(), + ProofLang::Cs => cs::has_dictionary(), + ProofLang::Id => id::has_dictionary(), + _ => return None, + }) +} + +/// The Hunspell name `lang` needs when `installed` is false (the first name its module looks for). fn dictionary_needed(lang: ProofLang, installed: bool) -> Option<&'static str> { match lang { _ if installed => None, ProofLang::Pl => Some("pl_PL"), ProofLang::Pt => Some("pt_BR"), + ProofLang::It => Some("it_IT"), + ProofLang::Hr => Some("hr_HR"), + ProofLang::Tr => Some("tr_TR"), + ProofLang::Ru => Some("ru_RU"), + ProofLang::Cs => Some("cs_CZ"), + ProofLang::Id => Some("id_ID"), _ => None, } } @@ -957,6 +968,23 @@ mod tests { assert_eq!(dictionary_needed(ProofLang::Pt, false), Some("pt_BR")); assert_eq!(dictionary_needed(ProofLang::Pl, true), None); assert_eq!(dictionary_needed(ProofLang::Pt, true), None); + // Every Hunspell language is named by the first name its module looks for (#3150). + for (l, name) in [ + (ProofLang::It, "it_IT"), + (ProofLang::Hr, "hr_HR"), + (ProofLang::Tr, "tr_TR"), + (ProofLang::Ru, "ru_RU"), + (ProofLang::Cs, "cs_CZ"), + (ProofLang::Id, "id_ID"), + ] { + assert_eq!(dictionary_needed(l, false), Some(name), "{l:?}"); + assert_eq!(dictionary_needed(l, true), None, "{l:?}"); + } + // Every proofed language other than English has a Hunspell dictionary to report. + for l in ProofLang::PROOFED { + let english = matches!(l, ProofLang::En | ProofLang::EnGb | ProofLang::EnCa); + assert_eq!(dictionary_needed(l, false).is_some(), !english, "{l:?}"); + } for l in [ProofLang::En, ProofLang::Bg, ProofLang::De, ProofLang::Other] { assert_eq!(dictionary_needed(l, false), None); } diff --git a/crates/proof/src/ru/mod.rs b/crates/proof/src/ru/mod.rs index 4b1ffe093..c29bbc7c5 100644 --- a/crates/proof/src/ru/mod.rs +++ b/crates/proof/src/ru/mod.rs @@ -63,10 +63,11 @@ pub fn dictionary() -> Arc { fn load_installed() -> AffixDict { let Some((aff, dic)) = crate::hunspell::find(NAMES) else { + crate::hunspell::clear_load_error(NAMES[0]); log::info!("Russian spelling: no Hunspell ru_RU dictionary installed"); return AffixDict::default(); }; - crate::hunspell::load(&aff, &dic).unwrap_or_else(|e| { + crate::hunspell::note_load(NAMES[0], &dic, crate::hunspell::load(&aff, &dic)).unwrap_or_else(|e| { log::warn!("Russian spelling: {e}"); AffixDict::default() }) diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 3caafc907..60053a871 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -7,6 +7,23 @@ use wordcraft_doc::{PartKind, StoryRef}; use crate::theme::{Tokens, TypeRung, fit_text, medium, paint_text, regular, semibold, text_width}; use crate::{WordApp, icons}; +/// Why the caret's language isn't spell-checked (dictionary unreadable or missing), if it isn't. +pub(crate) fn dictionary_problem(lang: &str, unreadable: &Option<(std::path::PathBuf, String)>, missing: Option<&str>) -> Option { + match (unreadable, missing) { + (Some((file, reason)), _) => Some(crate::i18n::fmt( + tl!("The spelling dictionary for {language} couldn't be read, so it isn't checked. File: {file}. Reason: {reason}"), + &[("language", lang), ("file", &file.to_string_lossy()), ("reason", reason)], + )), + (None, Some(name)) => Some(crate::i18n::fmt( + tl!( + "No spelling dictionary for {language} is installed, so it isn't checked. WordCraft looks for the Hunspell dictionary {name} in the WORDCRAFT_DICTIONARIES folder and in the usual system locations." + ), + &[("language", lang), ("name", name)], + )), + (None, None) => None, + } +} + /// The Quick Access Toolbar's button for command `id`. pub(crate) fn qat_button_id(id: &str) -> egui::Id { egui::Id::new(("qat_button", id)) @@ -590,17 +607,7 @@ pub fn status_bar(app: &mut WordApp, ui: &mut Ui) { } else { lang.clone() }; - let tip = match (&unreadable, missing) { - (Some((file, reason)), _) => crate::i18n::fmt( - tl!("The spelling dictionary for {language} couldn't be read, so it isn't checked. File: {file}. Reason: {reason}"), - &[("language", &lang), ("file", &file.to_string_lossy()), ("reason", reason)], - ), - (None, Some(name)) => crate::i18n::fmt( - tl!("No spelling dictionary for {language} is installed, so it isn't checked. WordCraft looks for the Hunspell dictionary {name} in the WORDCRAFT_DICTIONARIES folder and in the usual system locations."), - &[("language", &lang), ("name", name)], - ), - (None, None) => tl!("Language").to_string(), - }; + let tip = dictionary_problem(&lang, &unreadable, missing).unwrap_or_else(|| tl!("Language").to_string()); let resp = st(ui, &shown).on_hover_text(tip); egui::Popup::menu(&resp).show(|ui| { ui.set_min_width(200.0); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 05cce09db..b54861289 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -2182,7 +2182,9 @@ Show the mini toolbar when text is selected Показване на мини лентата с инструменти при избран текст Spaces Интервали Spelling Правопис - Spelling and grammar are checked in English (United States). Правописът и граматиката се проверяват на английски (САЩ). + Spelling and grammar are checked in {language}. Език за проверка на правописа и граматиката: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Текстът при курсора е отбелязан с: Без проверка на правописа и граматиката. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft все още не проверява правописа и граматиката на този език. Tab characters Знаци за табулация These marks show even when Show/Hide ¶ is off. Тези знаци се показват дори когато „Показване/скриване на ¶“ е изключено. Typing replaces selected text Въвежданият текст замества избрания текст diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index abf56a128..efdb43fbf 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -2275,7 +2275,9 @@ preview Title Ukázka Show the mini toolbar when text is selected Při výběru textu zobrazit miniaturní panel nástrojů Spaces Mezery Spelling Pravopis - Spelling and grammar are checked in English (United States). Pravopis a mluvnice se kontrolují v angličtině (Spojené státy). + Spelling and grammar are checked in {language}. Jazyk kontroly pravopisu a mluvnice: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Text v místě vkládání je označen: Nekontrolovat pravopis ani mluvnici. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft v tomto jazyce zatím nekontroluje pravopis ani mluvnici. Tab characters Znaky tabulátoru These marks show even when Show/Hide ¶ is off. Tyto značky se zobrazují, i když je vypnuto Zobrazit/skrýt ¶. Typing replaces selected text Psaný text nahrazuje vybraný text diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 282cd76eb..3c19ed79a 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1988,7 +1988,9 @@ Spaces Mellemrum Special Særlige Spelling Stavning - Spelling and grammar are checked in English (United States). Stavning og grammatik kontrolleres på engelsk (USA). + Spelling and grammar are checked in {language}. Sprog til stave- og grammatikkontrol: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Teksten ved indsætningspunktet er markeret: Kontrollér ikke stavning eller grammatik. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft kontrollerer endnu ikke stavning eller grammatik på dette sprog. Stacked Bar Stablet søjlediagram Stacked Column Stablet kolonnediagram Standard Standard diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index af9a50d5f..7d981fe84 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -1480,7 +1480,9 @@ Show the mini toolbar when text is selected Minisymbolleiste bei Textauswahl anzeigen Spaces Leerzeichen Spelling Rechtschreibung - Spelling and grammar are checked in English (United States). Rechtschreibung und Grammatik werden auf Englisch (USA) geprüft. + Spelling and grammar are checked in {language}. Sprache für Rechtschreibung und Grammatik: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Der Text an der Einfügemarke ist markiert: Rechtschreibung und Grammatik nicht prüfen. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft prüft Rechtschreibung und Grammatik in dieser Sprache noch nicht. Tab characters Tabstoppzeichen These marks show even when Show/Hide ¶ is off. Diese Zeichen werden auch angezeigt, wenn ¶ ein-/ausblenden deaktiviert ist. Typing replaces selected text Eingabe ersetzt markierten Text diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 7b60c0b59..791ce145b 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -182,7 +182,9 @@ Show the mini toolbar when text is selected Mostrar la minibarra de herramientas al seleccionar texto Spaces Espacios Spelling Ortografía - Spelling and grammar are checked in English (United States). La ortografía y la gramática se revisan en inglés (Estados Unidos). + Spelling and grammar are checked in {language}. Idioma de revisión de ortografía y gramática: {language}. + The text at the insertion point is marked Do not check spelling or grammar. El texto en el punto de inserción está marcado como: No revisar la ortografía ni la gramática. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft todavía no revisa la ortografía ni la gramática en este idioma. Tab characters Caracteres de tabulación Tab stop position: Posición de la tabulación: Default tab stops: Tabulaciones predeterminadas: diff --git a/crates/ui-egui/src/i18n/et.tsv b/crates/ui-egui/src/i18n/et.tsv index c6687355d..49473d746 100644 --- a/crates/ui-egui/src/i18n/et.tsv +++ b/crates/ui-egui/src/i18n/et.tsv @@ -764,7 +764,9 @@ Spelling & Grammar Õigekiri ja grammatika Spelling &\nGrammar Õigekiri ja\ngrammatika Spelling Suggestions Õigekirjasoovitused - Spelling and grammar are checked in English (United States). Õigekirja ja grammatikat kontrollitakse inglise keeles (Ameerika Ühendriigid). + Spelling and grammar are checked in {language}. Õigekirja ja grammatika kontrolli keel: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Sisestuskohal olev tekst on märgitud: Ära kontrolli õigekirja ega grammatikat. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft ei kontrolli selles keeles veel õigekirja ega grammatikat. Split Tükelda Split Cells Tükelda lahtrid Split Table Tükelda tabel diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3d451f0e6..f67633ff8 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -1939,7 +1939,9 @@ Show the mini toolbar when text is selected Afficher la mini barre d’outils lors de la sélection de texte Spaces Espaces Spelling Orthographe - Spelling and grammar are checked in English (United States). L’orthographe et la grammaire sont vérifiées en anglais (États-Unis). + Spelling and grammar are checked in {language}. Langue de vérification de l’orthographe et de la grammaire : {language}. + The text at the insertion point is marked Do not check spelling or grammar. Le texte au point d’insertion est marqué : Ne pas vérifier l’orthographe ni la grammaire. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language} : WordCraft ne vérifie pas encore l’orthographe ni la grammaire dans cette langue. Tab characters Caractères de tabulation These marks show even when Show/Hide ¶ is off. Ces marques s’affichent même lorsque Afficher/Masquer ¶ est désactivé. Typing replaces selected text La frappe remplace le texte sélectionné diff --git a/crates/ui-egui/src/i18n/hr.tsv b/crates/ui-egui/src/i18n/hr.tsv index e4ed78889..26befcc57 100644 --- a/crates/ui-egui/src/i18n/hr.tsv +++ b/crates/ui-egui/src/i18n/hr.tsv @@ -2100,7 +2100,9 @@ template Letter Pismo Spelling & Grammar Pravopis i gramatika Spelling &\nGrammar Pravopis i\ngramatika Spelling Suggestions Pravopisni prijedlozi - Spelling and grammar are checked in English (United States). Pravopis i gramatika provjeravaju se na engleskom (Sjedinjene Američke Države). + Spelling and grammar are checked in {language}. Jezik provjere pravopisa i gramatike: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Tekst na točki umetanja označen je: Ne provjeravaj pravopis ni gramatiku. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft na ovom jeziku još ne provjerava pravopis ni gramatiku. Split Podijeli Split Cells Podijeli ćelije Split Table Podijeli tablicu diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 1605bc293..fb93810d8 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1613,7 +1613,9 @@ Show the mini toolbar when text is selected Mini eszköztár megjelenítése szövegkijelöléskor Spaces Szóközök Spelling Helyesírás - Spelling and grammar are checked in English (United States). A helyesírás- és nyelvhelyesség-ellenőrzés nyelve: angol (Egyesült Államok). + Spelling and grammar are checked in {language}. A helyesírás- és nyelvhelyesség-ellenőrzés nyelve: {language}. + The text at the insertion point is marked Do not check spelling or grammar. A beszúrási pontnál lévő szöveg jelölése: Nincs helyesírás- és nyelvhelyesség-ellenőrzés. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: a WordCraft ezen a nyelven még nem ellenőrzi a helyesírást és a nyelvhelyességet. Tab characters Tabulátorok These marks show even when Show/Hide ¶ is off. Ezek a jelek akkor is látszanak, ha a Megjelenítés/elrejtés ¶ ki van kapcsolva. Typing replaces selected text A gépelés felülírja a kijelölt szöveget diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 5f02a42ae..e3c22564e 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -1558,7 +1558,9 @@ Show the mini toolbar when text is selected Mostra la barra di formattazione rapida quando selezioni il testo Spaces Spazi Spelling Ortografia - Spelling and grammar are checked in English (United States). L'ortografia e la grammatica vengono controllate in inglese (Stati Uniti). + Spelling and grammar are checked in {language}. Lingua del controllo ortografico e grammaticale: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Il testo nel punto di inserimento è contrassegnato: Non controllare ortografia e grammatica. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft non controlla ancora ortografia e grammatica in questa lingua. Tab characters Caratteri di tabulazione These marks show even when Show/Hide ¶ is off. Questi segni vengono mostrati anche quando Mostra tutto è disattivato. Typing replaces selected text Il testo digitato sostituisce la selezione diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 73658303d..5e93670f1 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -197,7 +197,9 @@ Show the mini toolbar when text is selected テキストを選択したときにミニ ツール バーを表示する Spaces スペース Spelling スペル チェック - Spelling and grammar are checked in English (United States). スペルと文法は英語 (米国) でチェックされます。 + Spelling and grammar are checked in {language}. スペルと文法のチェック言語: {language} + The text at the insertion point is marked Do not check spelling or grammar. 挿入ポイントのテキストの設定: スペルチェックと文章校正を行わない + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft はこの言語のスペルと文法をまだチェックしません。 Tab characters タブ Tab stop position: タブ位置: Default tab stops: 既定のタブ間隔: diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 9cbce2bd4..2da03818f 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -161,7 +161,9 @@ Show the mini toolbar when text is selected 텍스트를 선택할 때 미니 도구 모음 표시 Spaces 공백 Spelling 맞춤법 - Spelling and grammar are checked in English (United States). 맞춤법과 문법은 영어(미국)로 검사합니다. + Spelling and grammar are checked in {language}. 맞춤법 및 문법 검사 언어: {language} + The text at the insertion point is marked Do not check spelling or grammar. 삽입 위치의 텍스트 설정: 맞춤법 및 문법 검사 안 함 + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft는 아직 이 언어의 맞춤법 및 문법을 검사하지 않습니다. Tab characters 탭 문자 Tab stop position: 탭 위치: Default tab stops: 기본 탭 위치: diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 566948975..0b58facd4 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1988,7 +1988,9 @@ Spaces Spaties Special Speciaal Spelling Spelling - Spelling and grammar are checked in English (United States). Spelling en grammatica worden gecontroleerd in het Engels (Verenigde Staten). + Spelling and grammar are checked in {language}. Controletaal voor spelling en grammatica: {language}. + The text at the insertion point is marked Do not check spelling or grammar. De tekst bij de invoegpositie is gemarkeerd: Spelling of grammatica niet controleren. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft controleert in deze taal nog geen spelling of grammatica. Stacked Bar Gestapeld staafdiagram Stacked Column Gestapeld kolomdiagram Standard Standaard diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0235c84ae..453948dad 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -2053,7 +2053,9 @@ Spaces Spacje Special Specjalne Spelling Pisownia - Spelling and grammar are checked in English (United States). Pisownia i gramatyka są sprawdzane w języku angielskim (Stany Zjednoczone). + Spelling and grammar are checked in {language}. Język sprawdzania pisowni i gramatyki: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Tekst w punkcie wstawiania jest oznaczony: Nie sprawdzaj pisowni ani gramatyki. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft nie sprawdza jeszcze pisowni ani gramatyki w tym języku. Stacked Bar Słupkowy skumulowany Stacked Column Kolumnowy skumulowany Standard Standardowe diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 5d1d4a285..b7762e21f 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -177,7 +177,9 @@ Show the mini toolbar when text is selected Mostrar a minibarra de ferramentas ao selecionar texto Spaces Espaços Spelling Ortografia - Spelling and grammar are checked in English (United States). A ortografia e a gramática são verificadas em inglês (Estados Unidos). + Spelling and grammar are checked in {language}. Idioma da verificação de ortografia e gramática: {language}. + The text at the insertion point is marked Do not check spelling or grammar. O texto no ponto de inserção está marcado como: Não verificar ortografia nem gramática. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: o WordCraft ainda não verifica ortografia nem gramática neste idioma. Tab characters Caracteres de tabulação Tab stop position: Posição da tabulação: Default tab stops: Tabulações padrão: diff --git a/crates/ui-egui/src/i18n/ro.tsv b/crates/ui-egui/src/i18n/ro.tsv index 20b9ba982..284a7838f 100644 --- a/crates/ui-egui/src/i18n/ro.tsv +++ b/crates/ui-egui/src/i18n/ro.tsv @@ -2220,7 +2220,9 @@ Spelling & Grammar Ortografie și gramatică Spelling &\nGrammar Ortografie și\ngramatică Spelling Suggestions Sugestii de ortografie - Spelling and grammar are checked in English (United States). Ortografia și gramatica se verifică în engleză (Statele Unite). + Spelling and grammar are checked in {language}. Limba de verificare a ortografiei și gramaticii: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Textul de la punctul de inserare este marcat: Nu verifica ortografia și gramatica. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft nu verifică încă ortografia și gramatica în această limbă. Spike Spike Split Împărțire Split Cells Împărțire celule diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index bfd4765dc..573ebd48e 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2481,7 +2481,9 @@ preview Title Пример Show the mini toolbar when text is selected Показывать мини-панель при выделении текста Spaces Пробелы Spelling Орфография - Spelling and grammar are checked in English (United States). Орфография и грамматика проверяются для английского языка (США). + Spelling and grammar are checked in {language}. Язык проверки орфографии и грамматики: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Текст в точке вставки помечен: Не проверять орфографию и грамматику. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft пока не проверяет орфографию и грамматику на этом языке. Tab characters Знаки табуляции These marks show even when Show/Hide ¶ is off. Эти знаки видны, даже когда «Показать все знаки» выключено. Typing replaces selected text Ввод заменяет выделенный текст diff --git a/crates/ui-egui/src/i18n/sl.tsv b/crates/ui-egui/src/i18n/sl.tsv index c540fd514..a4605b730 100644 --- a/crates/ui-egui/src/i18n/sl.tsv +++ b/crates/ui-egui/src/i18n/sl.tsv @@ -2192,7 +2192,9 @@ Spelling Črkovanje Spelling & Grammar Črkovanje in slovnica Spelling &\nGrammar Črkovanje\nin slovnica - Spelling and grammar are checked in English (United States). Črkovanje in slovnica se preverjata v angleščini (Združene države). + Spelling and grammar are checked in {language}. Jezik preverjanja črkovanja in slovnice: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Besedilo na mestu vstavljanja je označeno: Ne preverjaj črkovanja ali slovnice. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft v tem jeziku še ne preverja črkovanja ali slovnice. Spelling Suggestions Predlogi za črkovanje Split Razdeli Split Cells Razdeli celice diff --git a/crates/ui-egui/src/i18n/sr-latn.tsv b/crates/ui-egui/src/i18n/sr-latn.tsv index 9cdd5c4e3..5967a6c80 100644 --- a/crates/ui-egui/src/i18n/sr-latn.tsv +++ b/crates/ui-egui/src/i18n/sr-latn.tsv @@ -254,7 +254,9 @@ Show the mini toolbar when text is selected Prikaži mini traku sa alatkama pri izboru teksta Spaces Razmaci Spelling Pravopis - Spelling and grammar are checked in English (United States). Pravopis i gramatika se proveravaju na engleskom (Sjedinjene Države). + Spelling and grammar are checked in {language}. Jezik provere pravopisa i gramatike: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Tekst na mestu umetanja je označen: Ne proveravaj pravopis ni gramatiku. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft još ne proverava pravopis ni gramatiku na ovom jeziku. Tab characters Znakovi tabulatora Tab stop position: Položaj tabulatora: Default tab stops: Podrazumevani tabulatori: diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index c7134d6d5..156a6015d 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -258,7 +258,9 @@ Show the mini toolbar when text is selected Прикажи мини траку са алаткама при избору текста Spaces Размаци Spelling Правопис - Spelling and grammar are checked in English (United States). Правопис и граматика се проверавају на енглеском (Сједињене Државе). + Spelling and grammar are checked in {language}. Језик провере правописа и граматике: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Текст на месту уметања је означен: Не проверавај правопис ни граматику. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft још не проверава правопис ни граматику на овом језику. Tab characters Знакови табулатора Tab stop position: Положај табулатора: Default tab stops: Подразумевани табулатори: diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index f936d47c0..0dd9fa570 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -176,7 +176,9 @@ Show the mini toolbar when text is selected Visa miniverktygsfältet när text är markerad Spaces Blanksteg Spelling Stavning - Spelling and grammar are checked in English (United States). Stavning och grammatik kontrolleras på engelska (USA). + Spelling and grammar are checked in {language}. Språk för stavnings- och grammatikkontroll: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Texten vid insättningspunkten är markerad: Kontrollera inte stavning eller grammatik. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft kontrollerar inte stavning eller grammatik på det här språket än. Tab characters Tabbtecken Tab stop position: Tabbstoppets position: Default tab stops: Standardtabbstopp: diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 41212c0d4..bbd16c831 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2480,7 +2480,9 @@ preview Title Örnek Show the mini toolbar when text is selected Metin seçildiğinde mini araç çubuğunu göster Spaces Boşluklar Spelling Yazım - Spelling and grammar are checked in English (United States). Yazım ve dil bilgisi İngilizce (Amerika Birleşik Devletleri) için denetlenir. + Spelling and grammar are checked in {language}. Yazım ve dil bilgisi denetimi dili: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Ekleme noktasındaki metin şu şekilde işaretli: Yazım ve dil bilgisini denetleme. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft bu dilde henüz yazım ve dil bilgisi denetimi yapmıyor. Tab characters Sekme karakterleri These marks show even when Show/Hide ¶ is off. Bu işaretler, Göster/Gizle ¶ kapalıyken de görünür. Typing replaces selected text Yazmak seçili metnin yerine geçer diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index a5c6bc702..6f2899432 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -179,7 +179,9 @@ Show the mini toolbar when text is selected Показувати міні-панель інструментів під час виділення тексту Spaces Пробіли Spelling Правопис - Spelling and grammar are checked in English (United States). Правопис і граматика перевіряються англійською (США). + Spelling and grammar are checked in {language}. Мова перевірки правопису та граматики: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Текст у точці вставлення позначено: Не перевіряти правопис і граматику. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft поки що не перевіряє правопис і граматику цією мовою. Tab characters Символи табуляції Tab stop position: Позиція табуляції: Default tab stops: Типові позиції табуляції: diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 8fe80c88a..e988b4c59 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -2175,7 +2175,9 @@ Show the mini toolbar when text is selected Hiện thanh công cụ mini khi chọn chữ Spaces Khoảng trắng Spelling Chính tả - Spelling and grammar are checked in English (United States). Soát chính tả và ngữ pháp bằng tiếng Anh (Mỹ). + Spelling and grammar are checked in {language}. Ngôn ngữ soát chính tả và ngữ pháp: {language}. + The text at the insertion point is marked Do not check spelling or grammar. Văn bản tại điểm chèn được đánh dấu: Không kiểm tra chính tả hoặc ngữ pháp. + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}: WordCraft chưa soát chính tả và ngữ pháp cho ngôn ngữ này. Tab characters Ký tự tab These marks show even when Show/Hide ¶ is off. Các dấu này vẫn hiện cả khi đã tắt Hiện/Ẩn ¶. Typing replaces selected text Gõ sẽ thay thế văn bản đã chọn diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 3230fa001..ab73b632c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -209,7 +209,9 @@ Show the mini toolbar when text is selected 选择文本时显示浮动工具栏 Spaces 空格 Spelling 拼写 - Spelling and grammar are checked in English (United States). 拼写和语法按英语(美国)检查。 + Spelling and grammar are checked in {language}. 拼写和语法检查语言:{language} + The text at the insertion point is marked Do not check spelling or grammar. 插入点处的文本已标记为:不检查拼写或语法 + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}:WordCraft 暂不检查此语言的拼写和语法 Tab characters 制表符 Tab stop position: 制表位位置: Default tab stops: 默认制表位: diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 4970f8c3e..a78f4d069 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -198,7 +198,9 @@ Show the mini toolbar when text is selected 選取文字時顯示迷你工具列 Spaces 空格 Spelling 拼字 - Spelling and grammar are checked in English (United States). 拼字和文法依英文(美國)檢查。 + Spelling and grammar are checked in {language}. 拼字和文法檢查語言:{language} + The text at the insertion point is marked Do not check spelling or grammar. 插入點處的文字已標示為:不要檢查拼字或文法 + {language}: WordCraft doesn't check spelling or grammar in this language yet. {language}:WordCraft 暫不檢查此語言的拼字和文法 Tab characters 定位字元 Tab stop position: 定位點位置: Default tab stops: 預設定位點間距: diff --git a/crates/ui-egui/src/options.rs b/crates/ui-egui/src/options.rs index a1f7f727b..00a053468 100644 --- a/crates/ui-egui/src/options.rs +++ b/crates/ui-egui/src/options.rs @@ -460,9 +460,17 @@ fn language(app: &mut WordApp, ui: &mut Ui) { // #414 (detect the document's language) goes here. ui.add_space(8.0); section(ui, "Proofing language"); - // The document's default language (Review › Language › Set As Default changes it). - let tag = app.session.doc.styles.default_chr.lang.clone(); - note(ui, &crate::ribbon::language_name(tag.as_deref())); + let lang = crate::ribbon::caret_language(app); + let text = if crate::ribbon::caret_no_proof(app) { + tl!("The text at the insertion point is marked Do not check spelling or grammar.").to_string() + } else if !crate::ribbon::caret_language_proofed(app) { + crate::i18n::fmt(tl!("{language}: WordCraft doesn't check spelling or grammar in this language yet."), &[("language", &lang)]) + } else { + let unreadable = crate::ribbon::caret_unreadable_dictionary(app); + crate::chrome::dictionary_problem(&lang, &unreadable, crate::ribbon::caret_missing_dictionary(app)) + .unwrap_or_else(|| crate::i18n::fmt(tl!("Spelling and grammar are checked in {language}."), &[("language", &lang)])) + }; + ui.label(RichText::new(text).small().weak()); } fn accessibility(app: &mut WordApp, ui: &mut Ui) { diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index fc43cfbcd..17eab9d2f 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -908,11 +908,27 @@ pub(crate) fn caret_language(app: &WordApp) -> String { tl!(&language_name(caret_lang_tag(app).as_deref())).to_string() } -/// The language tag at the caret, resolved through the styles and the document default. -fn caret_lang_tag(app: &WordApp) -> Option { +/// The formatting at the caret, resolved through the styles and the document default. +fn caret_char(app: &WordApp) -> wordcraft_doc::resolve::ResolvedChar { let s = &app.session; let style = s.doc.para_at(&s.sel.focus).and_then(|p| p.props.style.clone()); - s.doc.styles.resolve_char(style.as_deref(), &s.typing_props()).lang + s.doc.styles.resolve_char(style.as_deref(), &s.typing_props()) +} + +/// The language tag at the caret, resolved through the styles and the document default. +fn caret_lang_tag(app: &WordApp) -> Option { + caret_char(app).lang +} + +/// Is the text at the caret itself marked Do not check spelling or grammar? (`format.state` +/// looks at the whole word around a caret, so a partly marked word would read as checked.) +pub(crate) fn caret_no_proof(app: &WordApp) -> bool { + caret_char(app).no_proof +} + +/// Does WordCraft check spelling and grammar in the caret's language at all (Bulgarian: no)? +pub(crate) fn caret_language_proofed(app: &WordApp) -> bool { + wordcraft_engine::proof::has_dictionary(caret_lang_tag(app).as_deref()) } /// The Hunspell dictionary the caret's language needs but doesn't have (`pl_PL`), if any (#1167). diff --git a/docs/spelling-dictionaries.md b/docs/spelling-dictionaries.md index 9e90e91e0..2ca90618a 100644 --- a/docs/spelling-dictionaries.md +++ b/docs/spelling-dictionaries.md @@ -1,9 +1,9 @@ # Installing spelling dictionaries -> **Last reviewed:** 2026-10-16 · **Last updated:** 2026-10-18 · **Change:** trivial (ISO 8859-1 dictionaries are read, #2824; previously major: first version) +> **Last reviewed:** 2026-10-16 · **Last updated:** 2026-10-22 · **Change:** trivial (every Hunspell language shows (no dictionary), not only Polish and Portuguese, and Indonesian is listed, #3150; previously trivial: ISO 8859-1 dictionaries are read, #2824) -English spelling works out of the box. Polish, Russian, Portuguese, Czech, Italian, Croatian and -Turkish spelling use a standard **Hunspell** dictionary (an `.aff` and a `.dic` file) that +English spelling works out of the box. Polish, Russian, Portuguese, Czech, Italian, Croatian, +Turkish and Indonesian spelling use a standard **Hunspell** dictionary (an `.aff` and a `.dic` file) that WordCraft reads at runtime. These dictionaries are not bundled: they are large, and several are GPL or LGPL licensed. Without one, the language isn't checked. The status bar then shows the language with **(no dictionary)**, for example *Português (Brasil) (no dictionary)*. @@ -29,6 +29,7 @@ WordCraft looks for the first of these file names (each name means a `.aff | Italian | `it_IT`, `it_CH`, `it-IT`, `it` | LibreOffice `dict-it` | | Croatian | `hr_HR`, `hr-HR`, `hr` | LibreOffice `dict-hr` | | Turkish | `tr_TR`, `tr-TR`, `tr` | LibreOffice `dict-tr` | +| Indonesian | `id_ID`, `id-ID`, `id`, `in_ID` | LibreOffice `dict-id` | Every Portuguese region uses the same `pt_BR` dictionary, so text marked *Português (Portugal)* is checked with it too. @@ -127,6 +128,7 @@ Never commit dictionary files to this repository: they stay on the user's system | Date | Change | Summary | |---|---|---| +| 2026-10-22 | trivial | Italian, Croatian, Turkish, Russian, Czech and Indonesian without a dictionary now show **(no dictionary)** (or **(dictionary unreadable)**) too, as this page already said; before, only Polish and Portuguese did. Indonesian is listed with its file names (#3150) | | 2026-10-18 | trivial | ISO 8859-1 (`SET ISO8859-1`) dictionaries are read, so the original VERO `pt_BR` works without converting it to UTF-8 (#2824) | | 2026-10-18 | minor | An installed dictionary that can't be read shows **(dictionary unreadable)** in the status bar, with the file and reason in its tooltip and in File › Options › Proofing (#2830) | | 2026-10-16 | major | First version: the file names per language, the search order and folders on Windows, macOS and Linux, installing `pt_BR` on each, and how to check it works |