From c455c14fbe0979df27ff232f33c490a378223d96 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:04:41 +1030 Subject: [PATCH] Localise planting facts component (#5282) Extract hardcoded strings in app/views/plantings/_facts.html.haml to relative translation calls under plantings.facts across en, es, de, fr, ja, and zh locale files. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Daniel O'Connor --- app/views/plantings/_facts.html.haml | 56 ++++++++++++++-------------- config/locales/de.yml | 31 +++++++++++++++ config/locales/en.yml | 31 +++++++++++++++ config/locales/es.yml | 31 +++++++++++++++ config/locales/fr.yml | 31 +++++++++++++++ config/locales/ja.yml | 30 +++++++++++++++ config/locales/zh.yml | 31 +++++++++++++++ 7 files changed, 213 insertions(+), 28 deletions(-) diff --git a/app/views/plantings/_facts.html.haml b/app/views/plantings/_facts.html.haml index 9dac6defe..eeedf330b 100644 --- a/app/views/plantings/_facts.html.haml +++ b/app/views/plantings/_facts.html.haml @@ -8,68 +8,68 @@ .index-cards.facts.plantingfacts .card.fact-card{class: planting.planted_at.present? ? '' : 'text-muted'} %h3 - Planted + = t('.planted') = editable :date, planting, :planted_at, display_field: '.fact-planted' .fact-value.fact-planted - if planting.planted_at.present? %strong.planted_at= standard_time_distance planting.planted_at, Time.zone.today %span.planted_at= I18n.l planting.planted_at - else - %strong.planted_at unknown - %span.planted_at no date recorded + %strong.planted_at= t('.unknown') + %span.planted_at= t('.no_date_recorded') .card.fact-card{class: planting.percentage_grown.present? ? '' : 'text-muted'} - %h3 Progress + %h3= t('.progress') - if planting.failed? - %strong.plantingfact--progress Failed - %span= planting.finished_at.present? ? I18n.l(planting.finished_at) : 'this planting failed' + %strong.plantingfact--progress= t('.failed') + %span= planting.finished_at.present? ? I18n.l(planting.finished_at) : t('.planting_failed') - elsif planting.finished? - %strong.plantingfact--progress Done + %strong.plantingfact--progress= t('.done') %span - if planting.actual_lifespan.present? - = pluralize planting.actual_lifespan, 'day' + = t('.lifespan_days', count: planting.actual_lifespan) - else - finished + = t('.finished') - elsif planting.planned? - %strong.plantingfact--progress Planned - %span for #{I18n.l planting.planted_at} + %strong.plantingfact--progress= t('.planned') + %span= t('.planned_for', date: I18n.l(planting.planted_at)) - elsif planting.percentage_grown.present? %strong.plantingfact--progress #{planting.percentage_grown.to_i}% %span - if planting.finish_is_predicatable? - day #{planting.age_in_days} of #{planting.expected_lifespan} + = t('.day_progress', age: planting.age_in_days, lifespan: planting.expected_lifespan) - else - grown + = t('.grown') - else - %strong.plantingfact--progress unknown - %span no finish predicted + %strong.plantingfact--progress= t('.unknown') + %span= t('.no_finish_predicted') -# Quantity and the growing method were two cards that both said "seedling". -# One card, one sentence: "3 cuttings". Both fields stay editable from it. .card.fact-card{class: planting.quantity.to_i.positive? ? '' : 'text-muted'} %h3 - Quantity + = t('.quantity') = editable :text_field, planting, :quantity, display_field: '.fact-quantity' .fact-value.fact-quantity -# The sub-line is the unit, so it always names something countable: -# "3 cuttings", or "3 plants" when we don't know how they were started. -# It never reads "1, not recorded". %strong.plantingfact--quantity - = planting.quantity.to_i.positive? ? planting.quantity : 'unknown' + = planting.quantity.to_i.positive? ? planting.quantity : t('.unknown') %span.plantingfact--plantedfrom = (planting.planted_from.presence || 'plant').pluralize(planting.quantity.to_i) .card.fact-card{class: planting.sunniness.present? ? '' : 'text-muted'} %h3 - Grown in + = t('.grown_in') = editable :select, planting, :sunniness, values: Planting::SUNNINESS_VALUES, display_field: '.fact-sunniness' .fact-value.fact-sunniness %strong= sunniness_icon(planting.sunniness) %span.plantingfact--sunniness - = planting.sunniness.presence || 'not specified' + = planting.sunniness.presence || t('.not_specified') .card.fact-card{class: planting.overall_rating.present? ? '' : 'text-muted'} - %h3 Rating + %h3= t('.rating') -# The stars are the edit control for whoever owns the planting: click one -# to rate it. This is the one fact card the pencil doesn't suit. - if can?(:edit, planting) @@ -81,29 +81,29 @@ = icon(star <= planting.overall_rating.to_f.round ? 'fas' : 'far', 'star') %span.plantingfact--ratingvalue - if planting.overall_rating.present? - = "#{number_with_precision planting.overall_rating, precision: 1, strip_insignificant_zeros: true} of 5" + = t('.rating_of_5', rating: number_with_precision(planting.overall_rating, precision: 1, strip_insignificant_zeros: true)) - else - not rated + = t('.not_rated') -# Facts that only some plantings have. - if planting.parent_seed .card.fact-card - %h3 Parent seed + %h3= t('.parent_seed') = render 'seeds/thumbnail', seed: planting.parent_seed - if planting.sown_from_expired_seeds? %span.text-warning-emphasis - Sown from expired seeds (plant before #{planting.seed_plant_before.year}) + = t('.sown_from_expired', year: planting.seed_plant_before.year) - if planting.crop.perennial .card.fact-card - %h3.plantingfact--perennial Perennial + %h3.plantingfact--perennial= t('.perennial') %strong= perennial_icon - %span keeps growing year to year + %span= t('.perennial_description') - if planting.child_seeds.size.positive? .card.fact-card - %h3 Seeds saved + %h3= t('.seeds_saved') %strong = link_to planting_seeds_path(planting) do = seed_icon - %span.plantingfact--seedssaved #{pluralize(planting.child_seeds.size, 'packet')} of seed + %span.plantingfact--seedssaved= t('.packets_of_seed', count: planting.child_seeds.size) diff --git a/config/locales/de.yml b/config/locales/de.yml index afa10f09b..9131a6582 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1088,6 +1088,37 @@ de: late_finishing: spätveredelung sharedbuttonsfinish_planting: shared/buttons/finish_planting super_late: super spät + facts: + day_progress: "Tag %{age} von %{lifespan}" + done: Fertig + failed: Fehlgeschlagen + finished: beendet + grown: gewachsen + grown_in: Angebaut in + lifespan_days: + one: 1 Tag + other: "%{count} Tage" + no_date_recorded: kein Datum erfasst + no_finish_predicted: kein Ende vorhergesagt + not_rated: nicht bewertet + not_specified: nicht angegeben + packets_of_seed: + one: 1 Saatgutpäckchen + other: "%{count} Saatgutpäckchen" + parent_seed: Ausgangssaatgut + perennial: Mehrjährig + perennial_description: wächst von Jahr zu Jahr weiter + planned: Geplant + planned_for: "für %{date}" + planted: Gepflanzt + planting_failed: diese Pflanzung ist fehlgeschlagen + progress: Fortschritt + quantity: Menge + rating: Bewertung + rating_of_5: "%{rating} von 5" + seeds_saved: Saatgut gewonnen + sown_from_expired: "Aus abgelaufenem Saatgut gesät (pflanzen vor %{year})" + unknown: unbekannt form: failed_helper: Markieren Sie diese Pflanzung als fehlgeschlagen, wenn sie abgestorben ist oder ohne Ernte entfernt wurde. finish_helper: Eine Pflanzung ist beendet, wenn Sie die gesamte Ernte geerntet haben, oder sie stirbt, oder sie wächst anderweitig nicht mehr in Ihrem Garten. diff --git a/config/locales/en.yml b/config/locales/en.yml index 4136a47e4..908154c76 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1153,6 +1153,37 @@ en: late_finishing: late finishing sharedbuttonsfinish_planting: shared/buttons/finish_planting super_late: super late + facts: + day_progress: "day %{age} of %{lifespan}" + done: Done + failed: Failed + finished: finished + grown: grown + grown_in: Grown in + lifespan_days: + one: 1 day + other: "%{count} days" + no_date_recorded: no date recorded + no_finish_predicted: no finish predicted + not_rated: not rated + not_specified: not specified + packets_of_seed: + one: 1 packet of seed + other: "%{count} packets of seed" + parent_seed: Parent seed + perennial: Perennial + perennial_description: keeps growing year to year + planned: Planned + planned_for: "for %{date}" + planted: Planted + planting_failed: this planting failed + progress: Progress + quantity: Quantity + rating: Rating + rating_of_5: "%{rating} of 5" + seeds_saved: Seeds saved + sown_from_expired: "Sown from expired seeds (plant before %{year})" + unknown: unknown form: failed_helper: 'Mark this planting as failed if it died or was removed without any harvest. diff --git a/config/locales/es.yml b/config/locales/es.yml index e32b8b374..a888ba403 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1088,6 +1088,37 @@ es: late_finishing: terminar tarde sharedbuttonsfinish_planting: compartido/botones/finish_planting super_late: súper tarde + facts: + day_progress: "día %{age} de %{lifespan}" + done: Hecho + failed: Fallido + finished: finalizado + grown: crecido + grown_in: Cultivado en + lifespan_days: + one: 1 día + other: "%{count} días" + no_date_recorded: sin fecha registrada + no_finish_predicted: sin final previsto + not_rated: sin calificar + not_specified: no especificado + packets_of_seed: + one: 1 paquete de semillas + other: "%{count} paquetes de semillas" + parent_seed: Semilla madre + perennial: Perenne + perennial_description: sigue creciendo año tras año + planned: Planificado + planned_for: "para el %{date}" + planted: Plantado + planting_failed: esta plantación falló + progress: Progreso + quantity: Cantidad + rating: Calificación + rating_of_5: "%{rating} de 5" + seeds_saved: Semillas guardadas + sown_from_expired: "Sembrado de semillas caducadas (plantar antes de %{year})" + unknown: desconocido form: failed_helper: Marque esta plantación como fallida si murió o se eliminó sin ninguna cosecha. finish_helper: Una plantación finaliza cuando ha cosechado toda la cosecha, muere o ya no crece en su jardín. diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 6fd9e1179..792371429 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1089,6 +1089,37 @@ fr: late_finishing: finition tardive sharedbuttonsfinish_planting: shared/buttons/finish_planting super_late: super tard + facts: + day_progress: "jour %{age} sur %{lifespan}" + done: Terminé + failed: Échoué + finished: terminé + grown: poussé + grown_in: Cultivé en + lifespan_days: + one: 1 jour + other: "%{count} jours" + no_date_recorded: aucune date enregistrée + no_finish_predicted: aucune fin prévue + not_rated: non évalué + not_specified: non spécifié + packets_of_seed: + one: 1 sachet de graines + other: "%{count} sachets de graines" + parent_seed: Graine d'origine + perennial: Vivace + perennial_description: continue de pousser d'année en année + planned: Prévu + planned_for: "pour le %{date}" + planted: Planté + planting_failed: cette plantation a échoué + progress: Progrès + quantity: Quantité + rating: Évaluation + rating_of_5: "%{rating} sur 5" + seeds_saved: Graines récoltées + sown_from_expired: "Semé à partir de graines périmées (à planter avant %{year})" + unknown: inconnu form: failed_helper: Marquez cette plantation comme ayant échoué si elle est morte ou si elle a été retirée sans aucune récolte. finish_helper: Une plantation est terminée lorsque vous avez récolté toute la récolte, ou qu'elle meurt, ou qu'elle ne pousse plus dans votre jardin. diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 943fd8510..50faf4c5d 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -80,6 +80,36 @@ ja: unset_title: メールアドレスが設定されていません。 waiting_body: '%{email} に確認リンクを送信しました。リンクを開くとリマインダーの受信が始まります。' waiting_title: メールアドレスの確認をお待ちしています。 + plantings: + facts: + day_progress: "%{lifespan}日中 %{age}日目" + done: 完了 + failed: 失敗 + finished: 終了 + grown: 成長済み + grown_in: 日照条件 + lifespan_days: + other: "%{count}日" + no_date_recorded: 日付未記録 + no_finish_predicted: 終了予測なし + not_rated: 未評価 + not_specified: 指定なし + packets_of_seed: + other: "%{count}袋の種" + parent_seed: 親の種 + perennial: 多年草 + perennial_description: 年々成長し続けます + planned: 計画済み + planned_for: "%{date} 予定" + planted: 植え付け + planting_failed: この植え付けは失敗しました + progress: 進捗 + quantity: 数量 + rating: 評価 + rating_of_5: "%{rating} / 5" + seeds_saved: 保存した種 + sown_from_expired: "期限切れの種から播種(%{year}年までに植え付け)" + unknown: 不明 seeds: facts: cancel: キャンセル diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7a92765aa..dacc25a02 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1086,6 +1086,37 @@ zh: late_finishing: 后期整理 sharedbuttonsfinish_planting: 共享/按钮/finish_planting super_late: 超级晚了 + facts: + day_progress: "第 %{age} 天,共 %{lifespan} 天" + done: 已完成 + failed: 失败 + finished: 已结束 + grown: 已生长 + grown_in: 生长于 + lifespan_days: + one: 1 天 + other: "%{count} 天" + no_date_recorded: 未记录日期 + no_finish_predicted: 未预测结束时间 + not_rated: 未评分 + not_specified: 未指定 + packets_of_seed: + one: 1 包种子 + other: "%{count} 包种子" + parent_seed: 母株种子 + perennial: 多年生 + perennial_description: 年复一年持续生长 + planned: 已计划 + planned_for: "计划于 %{date}" + planted: 已种植 + planting_failed: 该种植已失败 + progress: 进度 + quantity: 数量 + rating: 评分 + rating_of_5: "%{rating} / 5 分" + seeds_saved: 已留种 + sown_from_expired: "使用过期种子播种(请在 %{year} 年前种植)" + unknown: 未知 form: failed_helper: 如果该种植死亡或在没有任何收获的情况下被移除,则将其标记为失败。 finish_helper: 当你收获了所有的作物,或者它死了,或者它不再在你的花园里生长时,种植就完成了。