mirror of
https://github.com/storytold/gridcraft.git
synced 2026-12-01 18:26:05 -06:00
i18n: Linear Trend and Growth Trend have a row in every catalog
The right-drag fill menu shows both labels through lang.tr, and no catalog had a row for them, so every interface language showed them in English. Each of the 18 catalogs now translates them, and a test checks that none falls back to English.
This commit is contained in:
@@ -418,6 +418,21 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// The right-drag fill menu's Linear Trend and Growth Trend have a row in every catalog, with
|
||||
/// no English fallback.
|
||||
#[test]
|
||||
fn trend_fill_labels_are_translated_in_every_catalog() {
|
||||
for key in ["Linear Trend", "Growth Trend"] {
|
||||
assert_eq!(Language::En.tr(key), key);
|
||||
for language in Language::ALL.into_iter().filter(|l| *l != Language::En) {
|
||||
let code = language.code();
|
||||
let shown = language.translated(key).unwrap_or_else(|| panic!("{code}: no row for {key:?}"));
|
||||
assert!(!shown.trim().is_empty() && !shown.contains('\n'), "{code}: bad translation of {key:?}: {shown:?}");
|
||||
assert_ne!(shown, key, "{code}: the row for {key:?} is still English");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn translations_never_show_the_context_prefix() {
|
||||
// `tr` returns a found translation as it is, so a catalog that keeps `context|` in its
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Czech translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Lineární trend",
|
||||
"Growth Trend" => "Exponenciální trend",
|
||||
"Diagram" => "Diagram",
|
||||
"Decorative Text" => "Ozdobný text",
|
||||
"Paste" => "Vložit",
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/// Returns the German translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Linearer Trend",
|
||||
"Growth Trend" => "Exponentieller Trend",
|
||||
"Diagram" => "Schema",
|
||||
"Decorative Text" => "Dekorativer Text",
|
||||
"Paste" => "Einfügen",
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
/// Returns the Greek translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Γραμμική τάση",
|
||||
"Growth Trend" => "Εκθετική τάση",
|
||||
"Diagram" => "Διάγραμμα",
|
||||
"Decorative Text" => "Διακοσμητικό κείμενο",
|
||||
"Paste" => "Επικόλληση",
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
/// Returns the Spanish translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Tendencia lineal",
|
||||
"Growth Trend" => "Tendencia geométrica",
|
||||
"Diagram" => "Diagrama",
|
||||
"Decorative Text" => "Texto decorativo",
|
||||
"Paste" => "Pegar",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the French translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Tendance linéaire",
|
||||
"Growth Trend" => "Tendance géométrique",
|
||||
"Diagram" => "Diagramme",
|
||||
"Decorative Text" => "Texte décoratif",
|
||||
"Different First Page" => "Première page différente",
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
/// Returns the Italian translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Tendenza lineare",
|
||||
"Growth Trend" => "Tendenza esponenziale",
|
||||
"Diagram" => "Diagramma",
|
||||
"Decorative Text" => "Testo decorativo",
|
||||
"Paste" => "Incolla",
|
||||
|
||||
@@ -1027,6 +1027,8 @@ pub(super) const DIALOGS: &[(&str, &str)] = &[
|
||||
/// Portuguese catalog has no entry for them either). Kept apart so the two catalogs above keep the
|
||||
/// same key set; it never overlaps them.
|
||||
pub(super) const EXTRA: &[(&str, &str)] = &[
|
||||
("Linear Trend", "線形近似"),
|
||||
("Growth Trend", "乗算近似"),
|
||||
("Cut (⌘X)", "切り取り (⌘X)"),
|
||||
("Copy (⌘C)", "コピー (⌘C)"),
|
||||
("Bold (⌘B)", "太字 (⌘B)"),
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Korean translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "선형 추세",
|
||||
"Growth Trend" => "지수 추세",
|
||||
"Diagram" => "다이어그램",
|
||||
"Decorative Text" => "장식 텍스트",
|
||||
"Paste" => "붙여넣기",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Dutch translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Lineaire trend",
|
||||
"Growth Trend" => "Groeitrend",
|
||||
"Diagram" => "Diagram",
|
||||
"Decorative Text" => "Decoratieve tekst",
|
||||
"Paste" => "Plakken",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/// Returns the Polish translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Trend liniowy",
|
||||
"Growth Trend" => "Trend wykładniczy",
|
||||
"Diagram" => "Diagram",
|
||||
"Decorative Text" => "Tekst ozdobny",
|
||||
"Paste" => "Wklej",
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/// Returns the Portuguese translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Tendência Linear",
|
||||
"Growth Trend" => "Tendência de Crescimento",
|
||||
"Diagram" => "Diagrama",
|
||||
"Decorative Text" => "Texto decorativo",
|
||||
"Paste" => "Colar",
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/// Returns the Romanian translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Tendință liniară",
|
||||
"Growth Trend" => "Tendință de creștere",
|
||||
"Diagram" => "Schemă",
|
||||
"Decorative Text" => "Text decorativ",
|
||||
"Paste" => "Lipire",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Russian translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Линейное приближение",
|
||||
"Growth Trend" => "Экспоненциальное приближение",
|
||||
"Diagram" => "Схема",
|
||||
"Decorative Text" => "Декоративный текст",
|
||||
"Paste" => "Вставить",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Serbian translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Linearni trend",
|
||||
"Growth Trend" => "Eksponencijalni trend",
|
||||
"Diagram" => "Dijagram",
|
||||
"Decorative Text" => "Ukrasni tekst",
|
||||
"Paste" => "Nalepi",
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/// Returns the Turkish translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Doğrusal Eğilim",
|
||||
"Growth Trend" => "Büyüme Eğilimi",
|
||||
"Diagram" => "Diyagram",
|
||||
"Decorative Text" => "Dekoratif Metin",
|
||||
"Paste" => "Yapıştır",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Ukrainian translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Лінійне наближення",
|
||||
"Growth Trend" => "Експоненційне наближення",
|
||||
"Diagram" => "Схема",
|
||||
"Decorative Text" => "Декоративний текст",
|
||||
"Paste" => "Вставити",
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/// Returns the Vietnamese translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "Xu hướng tuyến tính",
|
||||
"Growth Trend" => "Xu hướng tăng trưởng",
|
||||
"Diagram" => "Sơ đồ",
|
||||
"Decorative Text" => "Chữ trang trí",
|
||||
"Paste" => "Dán",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/// Returns the Chinese translation for `text`, or `None` so callers fall back to English.
|
||||
pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
Some(match text {
|
||||
"Linear Trend" => "线性趋势",
|
||||
"Growth Trend" => "等比趋势",
|
||||
"Diagram" => "图示",
|
||||
"Decorative Text" => "装饰文字",
|
||||
"Paste" => "粘贴",
|
||||
|
||||
Reference in New Issue
Block a user