Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

i18n: translate the Fill dialog, layer style contours and Image Size "(was …)" (#1291)

Arthur Vinícius006e1a34320d
diff --git a/contributors/people.toml b/contributors/people.toml
index ab57bdd14..5f294b149 100644
--- a/contributors/people.toml
+++ b/contributors/people.toml
@@ -30,3 +30,6 @@ sync_github_name = false
[people.reynold-hu]
real_name = "Reynold Hu"
sync_github_name = true
+
+[people.ArthurViniciusBA1]
+real_name = "Arthur Vinicius"
diff --git a/crates/ui-egui/src/fill_ui.rs b/crates/ui-egui/src/fill_ui.rs
index c591b5e0e..d72055b2a 100644
--- a/crates/ui-egui/src/fill_ui.rs
+++ b/crates/ui-egui/src/fill_ui.rs
@@ -135,7 +135,7 @@ pub fn body(app: &PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Value>)
ui.spacing_mut().item_spacing.y = 6.0;
let mut contents = get_str(f, "contents", "foreground");
ui.horizontal(|ui| {
- label(ui, "Contents:");
+ label(ui, tl!("Contents:"));
let opts: Vec<(String, &str)> = CONTENTS.iter().map(|(k, l)| (k.to_string(), *l)).collect();
if crate::widgets::dropdown(ui, "fill-contents", &mut contents, &opts, 170.0) {
f.insert("contents".into(), json!(contents));
@@ -144,7 +144,7 @@ pub fn body(app: &PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Value>)
match contents.as_str() {
"color" => {
ui.horizontal(|ui| {
- label(ui, "Color:");
+ label(ui, tl!("Color:"));
let mut rgb = parse_hex(&get_str(f, "color", "#000000"));
if egui::color_picker::color_edit_button_srgb(ui, &mut rgb).changed() {
f.insert("color".into(), json!(format!("#{:02x}{:02x}{:02x}", rgb[0], rgb[1], rgb[2])));
@@ -153,7 +153,7 @@ pub fn body(app: &PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Value>)
}
"pattern" => {
ui.horizontal(|ui| {
- label(ui, "Custom Pattern:");
+ label(ui, tl!("Custom Pattern:"));
let mut pat = get_str(f, "pattern", "");
let opts: Vec<(String, &str)> = app.session.patterns.items.iter().map(|p| (p.id.clone(), p.display_name())).collect();
if opts.is_empty() {
@@ -178,7 +178,7 @@ pub fn body(app: &PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Value>)
crate::widgets::section_label(ui, "Blending");
crate::widgets::hairline(ui);
ui.horizontal(|ui| {
- label(ui, "Mode:");
+ label(ui, tl!("Mode:"));
let mut mode = get_str(f, "mode", "normal");
let opts: Vec<(String, &str)> = photocraft_color::BlendMode::LAYER_MODES.iter().map(|m| (mode_key(*m), m.label())).collect();
if crate::widgets::dropdown(ui, "fill-mode", &mut mode, &opts, 170.0) {
@@ -186,7 +186,7 @@ pub fn body(app: &PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Value>)
}
});
ui.horizontal(|ui| {
- label(ui, "Opacity:");
+ label(ui, tl!("Opacity:"));
let mut o = f.get("opacity").and_then(Value::as_f64).unwrap_or(100.0) as f32;
if crate::widgets::value_field(ui, &mut o, 0.0..=100.0, "%", 70.0).changed() {
f.insert("opacity".into(), json!(o.round()));
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index d1a647fff..f4597bd3e 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -2145,3 +2145,17 @@ cameraRaw Color Barvy
Lines +/− Řádky +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR: {prs}, commity: {commits}, řádky +{added} / −{deleted} (Δ {delta}), binární soubory +{binAdded} / −{binDeleted}, {first} – {last}
Apply At Canvas Bounds Použít efekt na hranicích plátna
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Obsah:
+ Custom Pattern: Vlastní vzorek:
+ Foreground Color Barva popředí
+ Color… Barva…
+ 50% Gray 50% šedá
+ Color Adaptation Přizpůsobení barev
+ {size} (was {old}) {size} (dříve {old})
+ Cone Kužel
+ Cone (Inverted) Kužel (obrácený)
+ Domed Kopule
+ Domed (Inverted) Kopule (obrácená)
+ Diagonal (Descending) Diagonála (sestupná)
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 6a2ec19a3..8feac1dc5 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -2184,3 +2184,16 @@
Lines +/− Zeilen +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PRs, {commits} Commits, +{added} / −{deleted} Zeilen (Δ {delta}), +{binAdded} / −{binDeleted} Binärdateien, {first} – {last}
Apply At Canvas Bounds Effekt an Arbeitsflächenbegrenzungen anwenden
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Inhalt:
+ Custom Pattern: Eigenes Muster:
+ Foreground Color Vordergrundfarbe
+ Color… Farbe…
+ 50% Gray 50 % Grau
+ {size} (was {old}) {size} (vorher {old})
+ Cone Kegel
+ Cone (Inverted) Kegel (umgekehrt)
+ Domed Gewölbt
+ Domed (Inverted) Gewölbt (umgekehrt)
+ Diagonal (Descending) Diagonal (absteigend)
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index c52cce0f4..0c70eab9b 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2216,3 +2216,16 @@ cameraRaw Amount Cantidad
Lines +/− Líneas +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PR, {commits} commits, +{added} / −{deleted} líneas (Δ {delta}), +{binAdded} / −{binDeleted} archivos binarios, {first} – {last}
Apply At Canvas Bounds Aplicar efecto en los límites del lienzo
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Contenido:
+ Custom Pattern: Patrón personalizado:
+ Foreground Color Color frontal
+ Color… Color…
+ 50% Gray Gris al 50%
+ {size} (was {old}) {size} (antes {old})
+ Cone Cono
+ Cone (Inverted) Cono (invertido)
+ Domed Abovedado
+ Domed (Inverted) Abovedado (invertido)
+ Diagonal (Descending) Diagonal (descendente)
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 2300459b4..7b9737bb8 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -2576,3 +2576,16 @@ cameraRaw Blending Fusion
Lines +/− Lignes +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login} : {prs} PR, {commits} commits, +{added} / −{deleted} lignes (Δ {delta}), +{binAdded} / −{binDeleted} fichiers binaires, {first} – {last}
Apply At Canvas Bounds Appliquer l’effet aux limites de la zone de travail
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Contenu :
+ Custom Pattern: Motif personnalisé :
+ Foreground Color Couleur de premier plan
+ Color… Couleur…
+ 50% Gray Gris 50 %
+ {size} (was {old}) {size} (auparavant {old})
+ Cone Cône
+ Cone (Inverted) Cône (inversé)
+ Domed Bombé
+ Domed (Inverted) Bombé (inversé)
+ Diagonal (Descending) Diagonale (descendante)
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 6d653a0f7..a3ab716b7 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -2563,3 +2563,16 @@ cameraRaw Blending Pembauran
Lines +/− Baris +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PR, {commits} commit, +{added} / −{deleted} baris (Δ {delta}), +{binAdded} / −{binDeleted} berkas biner, {first} – {last}
Apply At Canvas Bounds Terapkan efek di batas kanvas
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Isi:
+ Custom Pattern: Pola Kustom:
+ Foreground Color Warna Foreground
+ Color… Warna…
+ 50% Gray Abu-abu 50%
+ {size} (was {old}) {size} (sebelumnya {old})
+ Cone Kerucut
+ Cone (Inverted) Kerucut (Terbalik)
+ Domed Kubah
+ Domed (Inverted) Kubah (Terbalik)
+ Diagonal (Descending) Diagonal (Menurun)
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 8e6118752..596d40566 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -2218,3 +2218,16 @@ cameraRaw Amount Quantità
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PR, {commits} commit, +{added} / −{deleted} righe (Δ {delta}), +{binAdded} / −{binDeleted} risorse binarie, {first} – {last}
Convert to Layers Converti in livelli
Apply At Canvas Bounds Applica effetto ai limiti dell’area di lavoro
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Contenuto:
+ Custom Pattern: Pattern personalizzato:
+ Foreground Color Colore primo piano
+ Color… Colore…
+ 50% Gray Grigio 50%
+ {size} (was {old}) {size} (prima {old})
+ Cone Cono
+ Cone (Inverted) Cono (invertito)
+ Domed Bombato
+ Domed (Inverted) Bombato (invertito)
+ Diagonal (Descending) Diagonale (discendente)
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 713d8a76c..cfa9c71be 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -2128,3 +2128,17 @@ cameraRaw Color カラー
Lines +/− 行数 +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR {prs} 件、コミット {commits} 件、行 +{added} / −{deleted} (Δ {delta})、バイナリ +{binAdded} / −{binDeleted}、{first} – {last}
Apply At Canvas Bounds カンバスの境界に効果を適用
+
+# Fill dialog, layer style contours and Image Size
+ Contents: 内容:
+ Custom Pattern: カスタムパターン:
+ Foreground Color 描画色
+ Color… カラー…
+ 50% Gray 50% グレー
+ Color Adaptation カラー適応
+ {size} (was {old}) {size}(変更前 {old})
+ Cone 円錐
+ Cone (Inverted) 円錐 (反転)
+ Domed ドーム
+ Domed (Inverted) ドーム (反転)
+ Diagonal (Descending) 斜め (下降)
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index b56b68461..c24c541e9 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -2731,3 +2731,16 @@ cameraRaw Color 색상
Apply At Canvas Bounds 캔버스 경계에 효과 적용
Good 좋음
Best 최적
+
+# Fill dialog, layer style contours and Image Size
+ Contents: 내용:
+ Custom Pattern: 사용자 정의 패턴:
+ Foreground Color 전경색
+ Color… 색상…
+ 50% Gray 50% 회색
+ Color Adaptation 색상 적응
+ {size} (was {old}) {size} (이전 {old})
+ Cone (Inverted) 원뿔(반전)
+ Domed 돔
+ Domed (Inverted) 돔(반전)
+ Diagonal (Descending) 대각선(내림)
diff --git a/crates/ui-egui/src/i18n/live_tests.rs b/crates/ui-egui/src/i18n/live_tests.rs
index b58e7a2ca..ee4baa3d9 100644
--- a/crates/ui-egui/src/i18n/live_tests.rs
+++ b/crates/ui-egui/src/i18n/live_tests.rs
@@ -74,6 +74,30 @@ fn dynamic_brush_sections_have_translations_and_draw_in_the_selected_language()
});
}
+#[test]
+fn fill_dialog_and_contour_choices_have_translations_and_draw_in_the_selected_language() {
+ let labels = ["Contents:", "Color:", "Custom Pattern:", "Mode:", "Opacity:", "{size} (was {old})"];
+ for language in Lang::all().filter(|language| language.complete_menus()) {
+ let contents = crate::fill_ui::CONTENTS.iter().map(|(_, label)| *label);
+ let contours = photocraft_engine::layer_style::CONTOURS.iter().map(|(name, _)| *name);
+ for text in labels.into_iter().chain(contents).chain(contours) {
+ assert!(has(language, text), "{}: untranslated {text}", language.code());
+ }
+ }
+ with_language(Lang::EN, || {
+ let mut h = harness();
+ h.state_mut().run("prefs.set", json!({"path": "interface.language", "value": "pt-br"})).expect("language");
+ let ctx = h.ctx.clone();
+ crate::menus::invoke(h.state_mut(), &ctx, crate::fill_ui::COMMAND, json!({})).expect("fill dialog");
+ h.run_steps(4);
+ let text = drawn_text(&h);
+ for want in ["Conteúdo:", "Cor de primeiro plano", "Modo:", "Opacidade:"] {
+ assert!(text.iter().any(|text| text == want), "missing {want}");
+ }
+ assert!(!text.iter().any(|text| text == "Contents:" || text == "Foreground Color"));
+ });
+}
+
#[test]
fn cjk_font_order_follows_the_selected_language() {
use photocraft_text::cjk::CjkScript;
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 2dba33fe4..79f65c5b8 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -3186,3 +3186,15 @@ cameraRaw Roughness Chropowatość
Camera Raw ({name}) Camera Raw ({name})
New Brush Preset… Nowe ustawienie wstępne pędzla…
Brush Preset Options Opcje ustawień wstępnych pędzla
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Zawartość:
+ Custom Pattern: Własny wzór:
+ Foreground Color Kolor pierwszego planu
+ Color… Kolor…
+ 50% Gray 50% szarości
+ {size} (was {old}) {size} (wcześniej {old})
+ Cone (Inverted) Stożek (odwrócony)
+ Domed Kopuła
+ Domed (Inverted) Kopuła (odwrócona)
+ Diagonal (Descending) Przekątna (malejąca)
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 079ecd98e..392bcc1ea 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -2583,3 +2583,16 @@ cameraRaw Whites Brancos
Lines +/− Linhas +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} linhas (Δ {delta}), +{binAdded} / −{binDeleted} arquivos binários, {first} – {last}
Apply At Canvas Bounds Aplicar efeito nos limites da tela
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Conteúdo:
+ Custom Pattern: Padrão personalizado:
+ Foreground Color Cor de primeiro plano
+ Color… Cor…
+ 50% Gray Cinza 50%
+ {size} (was {old}) {size} (antes {old})
+ Cone Cone
+ Cone (Inverted) Cone (invertido)
+ Domed Abaulado
+ Domed (Inverted) Abaulado (invertido)
+ Diagonal (Descending) Diagonal (descendente)
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 8d81e48cd..6b706ae0f 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2422,3 +2422,17 @@ cameraRaw Roughness Неровность
Lines +/− Строки +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}: PR: {prs}, коммиты: {commits}, строки +{added} / −{deleted} (Δ {delta}), двоичные файлы +{binAdded} / −{binDeleted}, {first} – {last}
Apply At Canvas Bounds Применить эффект на границах холста
+
+# Fill dialog, layer style contours and Image Size
+ Contents: Содержимое:
+ Custom Pattern: Свой узор:
+ Foreground Color Основной цвет
+ Color… Цвет…
+ 50% Gray 50% серого
+ {size} (was {old}) {size} (было {old})
+ Cone Конус
+ Cone (Inverted) Конус (инвертированный)
+ Domed Купол
+ Domed (Inverted) Купол (инвертированный)
+ Diagonal (Descending) Диагональ (нисходящая)
+ Linear Линейный
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 1a3ec7ab9..237c10f5c 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2153,3 +2153,17 @@ cameraRaw Blending 混合
Lines +/− 行数 +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}:{prs} 个 PR,{commits} 次提交,行 +{added} / −{deleted}(Δ {delta}),二进制文件 +{binAdded} / −{binDeleted},{first} – {last}
Apply At Canvas Bounds 应用画布边界的效果
+
+# Fill dialog, layer style contours and Image Size
+ Contents: 内容:
+ Custom Pattern: 自定义图案:
+ Foreground Color 前景色
+ Color… 颜色…
+ 50% Gray 50% 灰色
+ Color Adaptation 颜色自适应
+ {size} (was {old}) {size}(原为 {old})
+ Cone 锥形
+ Cone (Inverted) 锥形(反转)
+ Domed 圆顶
+ Domed (Inverted) 圆顶(反转)
+ Diagonal (Descending) 对角线(下降)
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index e8fa1dbdd..d9a281e4f 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2122,3 +2122,17 @@ cameraRaw Blending 混合
Lines +/− 行數 +/−
@{login}: {prs} PRs, {commits} commits, +{added} / −{deleted} lines (Δ {delta}), +{binAdded} / −{binDeleted} binary assets, {first} – {last} @{login}:{prs} 個 PR,{commits} 次提交,行 +{added} / −{deleted}(Δ {delta}),二進位檔 +{binAdded} / −{binDeleted},{first} – {last}
Apply At Canvas Bounds 套用效果至版面邊界
+
+# Fill dialog, layer style contours and Image Size
+ Contents: 內容:
+ Custom Pattern: 自訂圖樣:
+ Foreground Color 前景色
+ Color… 顏色…
+ 50% Gray 50% 灰色
+ Color Adaptation 顏色適應
+ {size} (was {old}) {size}(原為 {old})
+ Cone 錐形
+ Cone (Inverted) 錐形(反轉)
+ Domed 圓頂
+ Domed (Inverted) 圓頂(反轉)
+ Diagonal (Descending) 對角線(下降)
diff --git a/crates/ui-egui/src/sizing.rs b/crates/ui-egui/src/sizing.rs
index 55085f96a..ae3e94007 100644
--- a/crates/ui-egui/src/sizing.rs
+++ b/crates/ui-egui/src/sizing.rs
@@ -166,7 +166,7 @@ fn image_size(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
let resample = f.get("resample").and_then(Value::as_str).unwrap_or("bicubic").to_string();
let resampling = resample != "none";
let (w, h) = (num(f, "width").round(), num(f, "height").round());
- info_row(ui, tl!("Image Size:"), format!("{} (was {})", human_bytes(w * h * bpp), human_bytes(ow * oh * bpp)));
+ info_row(ui, tl!("Image Size:"), crate::i18n::fmt(tl!("{size} (was {old})"), &[("size", &human_bytes(w * h * bpp)), ("old", &human_bytes(ow * oh * bpp))]));
info_row(ui, tl!("Dimensions:"), format!("{} px × {} px", w as i64, h as i64));
ui.add_space(6.0);
let mut constrain = f.get("__constrain").and_then(Value::as_bool).unwrap_or(true);