use std::sync::Arc;
use super::Plural;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct EditingWords {
pub find: Arc<str>,
pub replace: Arc<str>,
pub previous_match: Arc<str>,
pub next_match: Arc<str>,
pub match_case: Arc<str>,
pub match_whole_word: Arc<str>,
pub use_regex: Arc<str>,
pub replace_all: Arc<str>,
pub toggle_replace: Arc<str>,
pub search_options: Arc<str>,
pub formatting: Arc<str>,
pub text_style: Arc<str>,
pub paragraph: Arc<str>,
pub heading: Arc<str>,
pub code_block: Arc<str>,
pub bold: Arc<str>,
pub italic: Arc<str>,
pub underline: Arc<str>,
pub strikethrough: Arc<str>,
pub bulleted_list: Arc<str>,
pub numbered_list: Arc<str>,
pub quote: Arc<str>,
pub code: Arc<str>,
pub link: Arc<str>,
pub image: Arc<str>,
pub undo: Arc<str>,
pub redo: Arc<str>,
pub cut: Arc<str>,
pub copy: Arc<str>,
pub paste: Arc<str>,
pub paste_link: Arc<str>,
pub remove_link: Arc<str>,
pub markdown_shortcuts: Arc<str>,
pub words: Plural,
pub copy_code: Arc<str>,
pub copied: Arc<str>,
pub copy_failed: Arc<str>,
pub command_placeholder: Arc<str>,
pub to_move: Arc<str>,
pub to_run: Arc<str>,
pub to_close: Arc<str>,
pub note: Arc<str>,
pub tip: Arc<str>,
pub important: Arc<str>,
pub warning: Arc<str>,
pub caution: Arc<str>,
pub back_to_reference: Arc<str>,
}
impl EditingWords {
pub fn english() -> Self {
Self {
find: "Find".into(),
replace: "Replace".into(),
previous_match: "Previous match".into(),
next_match: "Next match".into(),
match_case: "Match case".into(),
match_whole_word: "Match whole word".into(),
use_regex: "Use regular expression".into(),
replace_all: "Replace all".into(),
toggle_replace: "Toggle replace".into(),
search_options: "Search options".into(),
formatting: "Formatting".into(),
text_style: "Text style".into(),
paragraph: "Paragraph".into(),
heading: "Heading {level}".into(),
code_block: "Code block".into(),
bold: "Bold".into(),
italic: "Italic".into(),
underline: "Underline".into(),
strikethrough: "Strikethrough".into(),
bulleted_list: "Bulleted list".into(),
numbered_list: "Numbered list".into(),
quote: "Quote".into(),
code: "Code".into(),
link: "Link".into(),
image: "Image".into(),
undo: "Undo".into(),
redo: "Redo".into(),
cut: "Cut".into(),
copy: "Copy".into(),
paste: "Paste".into(),
paste_link: "Paste a link".into(),
remove_link: "Remove link".into(),
markdown_shortcuts: "Markdown shortcuts on".into(),
words: Plural::two("{count} word", "{count} words"),
copy_code: "Copy code".into(),
copied: "Copied".into(),
copy_failed: "Couldn't copy".into(),
command_placeholder: "Type a command or search".into(),
to_move: "to move".into(),
to_run: "to run".into(),
to_close: "to close".into(),
note: "Note".into(),
tip: "Tip".into(),
important: "Important".into(),
warning: "Warning".into(),
caution: "Caution".into(),
back_to_reference: "Back to the reference {number}".into(),
}
}
pub fn for_language(language: &str) -> Self {
match language {
"uk" => Self {
find: "Знайти".into(),
replace: "Замінити".into(),
previous_match: "Попередній збіг".into(),
next_match: "Наступний збіг".into(),
match_case: "Враховувати регістр".into(),
match_whole_word: "Лише цілі слова".into(),
use_regex: "Регулярний вираз".into(),
replace_all: "Замінити все".into(),
toggle_replace: "Показати або сховати заміну".into(),
search_options: "Параметри пошуку".into(),
formatting: "Форматування".into(),
text_style: "Стиль тексту".into(),
paragraph: "Абзац".into(),
heading: "Заголовок {level}".into(),
code_block: "Блок коду".into(),
bold: "Жирний".into(),
italic: "Курсив".into(),
underline: "Підкреслений".into(),
strikethrough: "Закреслений".into(),
bulleted_list: "Маркований список".into(),
numbered_list: "Нумерований список".into(),
quote: "Цитата".into(),
code: "Код".into(),
link: "Посилання".into(),
image: "Зображення".into(),
undo: "Скасувати".into(),
redo: "Повторити".into(),
cut: "Вирізати".into(),
copy: "Копіювати".into(),
paste: "Вставити".into(),
paste_link: "Вставте посилання".into(),
remove_link: "Вилучити посилання".into(),
markdown_shortcuts: "Скорочення Markdown увімкнено".into(),
words: Plural::three("{count} слово", "{count} слова", "{count} слів"),
copy_code: "Копіювати код".into(),
copied: "Скопійовано".into(),
copy_failed: "Не вдалося скопіювати".into(),
command_placeholder: "Введіть команду або пошуковий запит".into(),
to_move: "перейти".into(),
to_run: "виконати".into(),
to_close: "закрити".into(),
note: "Примітка".into(),
tip: "Порада".into(),
important: "Важливо".into(),
warning: "Попередження".into(),
caution: "Обережно".into(),
back_to_reference: "Назад до посилання {number}".into(),
},
"de" => Self {
find: "Suchen".into(),
replace: "Ersetzen".into(),
previous_match: "Vorheriger Treffer".into(),
next_match: "Nächster Treffer".into(),
match_case: "Groß-/Kleinschreibung beachten".into(),
match_whole_word: "Nur ganzes Wort".into(),
use_regex: "Regulären Ausdruck verwenden".into(),
replace_all: "Alle ersetzen".into(),
toggle_replace: "Ersetzen ein-/ausblenden".into(),
search_options: "Suchoptionen".into(),
formatting: "Formatierung".into(),
text_style: "Textstil".into(),
paragraph: "Absatz".into(),
heading: "Überschrift {level}".into(),
code_block: "Codeblock".into(),
bold: "Fett".into(),
italic: "Kursiv".into(),
underline: "Unterstrichen".into(),
strikethrough: "Durchgestrichen".into(),
bulleted_list: "Aufzählung".into(),
numbered_list: "Nummerierte Liste".into(),
quote: "Zitat".into(),
code: "Code".into(),
link: "Link".into(),
image: "Bild".into(),
undo: "Rückgängig".into(),
redo: "Wiederholen".into(),
cut: "Ausschneiden".into(),
copy: "Kopieren".into(),
paste: "Einsetzen".into(),
paste_link: "Link einfügen".into(),
remove_link: "Link entfernen".into(),
markdown_shortcuts: "Markdown-Kürzel aktiv".into(),
words: Plural::two("{count} Wort", "{count} Wörter"),
copy_code: "Code kopieren".into(),
copied: "Kopiert".into(),
copy_failed: "Kopieren fehlgeschlagen".into(),
command_placeholder: "Befehl eingeben oder suchen".into(),
to_move: "zum Bewegen".into(),
to_run: "zum Ausführen".into(),
to_close: "zum Schließen".into(),
note: "Hinweis".into(),
tip: "Tipp".into(),
important: "Wichtig".into(),
warning: "Warnung".into(),
caution: "Vorsicht".into(),
back_to_reference: "Zurück zum Verweis {number}".into(),
},
"fr" => Self {
find: "Rechercher".into(),
replace: "Remplacer".into(),
previous_match: "Résultat précédent".into(),
next_match: "Résultat suivant".into(),
match_case: "Respecter la casse".into(),
match_whole_word: "Mot entier uniquement".into(),
use_regex: "Utiliser une expression régulière".into(),
replace_all: "Tout remplacer".into(),
toggle_replace: "Afficher ou masquer le remplacement".into(),
search_options: "Options de recherche".into(),
formatting: "Mise en forme".into(),
text_style: "Style de texte".into(),
paragraph: "Paragraphe".into(),
heading: "Titre {level}".into(),
code_block: "Bloc de code".into(),
bold: "Gras".into(),
italic: "Italique".into(),
underline: "Souligné".into(),
strikethrough: "Barré".into(),
bulleted_list: "Liste à puces".into(),
numbered_list: "Liste numérotée".into(),
quote: "Citation".into(),
code: "Code".into(),
link: "Lien".into(),
image: "Image".into(),
undo: "Annuler".into(),
redo: "Rétablir".into(),
cut: "Couper".into(),
copy: "Copier".into(),
paste: "Coller".into(),
paste_link: "Collez un lien".into(),
remove_link: "Supprimer le lien".into(),
markdown_shortcuts: "Raccourcis Markdown activés".into(),
words: Plural::two("{count} mot", "{count} mots"),
copy_code: "Copier le code".into(),
copied: "Copié".into(),
copy_failed: "Échec de la copie".into(),
command_placeholder: "Saisissez une commande ou recherchez".into(),
to_move: "pour naviguer".into(),
to_run: "pour exécuter".into(),
to_close: "pour fermer".into(),
note: "Remarque".into(),
tip: "Astuce".into(),
important: "Important".into(),
warning: "Avertissement".into(),
caution: "Attention".into(),
back_to_reference: "Retour à la référence {number}".into(),
},
"es" => Self {
find: "Buscar".into(),
replace: "Reemplazar".into(),
previous_match: "Coincidencia anterior".into(),
next_match: "Coincidencia siguiente".into(),
match_case: "Distinguir mayúsculas y minúsculas".into(),
match_whole_word: "Solo palabras completas".into(),
use_regex: "Usar expresión regular".into(),
replace_all: "Reemplazar todo".into(),
toggle_replace: "Mostrar u ocultar reemplazo".into(),
search_options: "Opciones de búsqueda".into(),
formatting: "Formato".into(),
text_style: "Estilo de texto".into(),
paragraph: "Párrafo".into(),
heading: "Título {level}".into(),
code_block: "Bloque de código".into(),
bold: "Negrita".into(),
italic: "Cursiva".into(),
underline: "Subrayado".into(),
strikethrough: "Tachado".into(),
bulleted_list: "Lista con viñetas".into(),
numbered_list: "Lista numerada".into(),
quote: "Cita".into(),
code: "Código".into(),
link: "Enlace".into(),
image: "Imagen".into(),
undo: "Deshacer".into(),
redo: "Rehacer".into(),
cut: "Cortar".into(),
copy: "Copiar".into(),
paste: "Pegar".into(),
paste_link: "Pega un enlace".into(),
remove_link: "Quitar enlace".into(),
markdown_shortcuts: "Atajos de Markdown activados".into(),
words: Plural::two("{count} palabra", "{count} palabras"),
copy_code: "Copiar código".into(),
copied: "Copiado".into(),
copy_failed: "No se pudo copiar".into(),
command_placeholder: "Escribe un comando o busca".into(),
to_move: "para moverte".into(),
to_run: "para ejecutar".into(),
to_close: "para cerrar".into(),
note: "Nota".into(),
tip: "Consejo".into(),
important: "Importante".into(),
warning: "Advertencia".into(),
caution: "Precaución".into(),
back_to_reference: "Volver a la referencia {number}".into(),
},
"pl" => Self {
find: "Znajdź".into(),
replace: "Zamień".into(),
previous_match: "Poprzednie dopasowanie".into(),
next_match: "Następne dopasowanie".into(),
match_case: "Uwzględniaj wielkość liter".into(),
match_whole_word: "Tylko całe wyrazy".into(),
use_regex: "Użyj wyrażenia regularnego".into(),
replace_all: "Zamień wszystko".into(),
toggle_replace: "Pokaż lub ukryj zamianę".into(),
search_options: "Opcje wyszukiwania".into(),
formatting: "Formatowanie".into(),
text_style: "Styl tekstu".into(),
paragraph: "Akapit".into(),
heading: "Nagłówek {level}".into(),
code_block: "Blok kodu".into(),
bold: "Pogrubienie".into(),
italic: "Kursywa".into(),
underline: "Podkreślenie".into(),
strikethrough: "Przekreślenie".into(),
bulleted_list: "Lista punktowana".into(),
numbered_list: "Lista numerowana".into(),
quote: "Cytat".into(),
code: "Kod".into(),
link: "Link".into(),
image: "Obraz".into(),
undo: "Cofnij".into(),
redo: "Ponów".into(),
cut: "Wytnij".into(),
copy: "Kopiuj".into(),
paste: "Wklej".into(),
paste_link: "Wklej link".into(),
remove_link: "Usuń link".into(),
markdown_shortcuts: "Skróty Markdown włączone".into(),
words: Plural::three("{count} słowo", "{count} słowa", "{count} słów"),
copy_code: "Kopiuj kod".into(),
copied: "Skopiowano".into(),
copy_failed: "Nie udało się skopiować".into(),
command_placeholder: "Wpisz polecenie lub wyszukaj".into(),
to_move: "aby przejść".into(),
to_run: "aby wykonać".into(),
to_close: "aby zamknąć".into(),
note: "Uwaga".into(),
tip: "Wskazówka".into(),
important: "Ważne".into(),
warning: "Ostrzeżenie".into(),
caution: "Przestroga".into(),
back_to_reference: "Wróć do odwołania {number}".into(),
},
_ => Self::english(),
}
}
}
impl Default for EditingWords {
fn default() -> Self {
Self::english()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_language_has_every_word_with_its_places() {
for language in super::super::locale::LANGUAGES {
let words = EditingWords::for_language(language);
assert!(words.heading.contains("{level}"), "{language}");
assert!(words.back_to_reference.contains("{number}"), "{language}");
assert!(
words.words.forms().iter().all(|form| form.contains("{count}")),
"{language}"
);
assert!(!words.find.is_empty() && !words.caution.is_empty(), "{language}");
}
assert_eq!(EditingWords::for_language("xx"), EditingWords::english());
}
}