From 2a0fcd4faead9e2dc9adf19dfc5face5cea7f7b3 Mon Sep 17 00:00:00 2001 From: Tao Chen <42793494+IamTaoChen@users.noreply.github.com> Date: Wed, 13 May 2026 03:28:00 +0800 Subject: [PATCH] feat: opening_balance_date and opening_balance(i18n) (#1377) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * make default of opening_balance_date_label is TODAY * feat(i18n): add multi-language support for opening balance label - Use `t("valuations.show.opening_balance")` for all opening balance display (list and detail views) - Add or update `opening_balance` translation in all major languages under `config/locales/views/valuations/` - Now "Opening balance" will be localized in all supported languages * revert -2.years * Update config/locales/views/valuations/es.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Juan José Mata * Update config/locales/views/valuations/pt-BR.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Juan José Mata * Fix indentation for opening_balance in ro.yml Signed-off-by: Juan José Mata * Fix indentation for opening_balance in Turkish locale Signed-off-by: Juan José Mata * Update zh-TW.yml Signed-off-by: Juan José Mata --------- Signed-off-by: Juan José Mata Co-authored-by: Juan José Mata Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- app/views/valuations/_header.html.erb | 3 ++- app/views/valuations/_valuation.html.erb | 10 ++++++---- config/locales/views/valuations/de.yml | 1 + config/locales/views/valuations/en.yml | 1 + config/locales/views/valuations/es.yml | 1 + config/locales/views/valuations/fr.yml | 1 + config/locales/views/valuations/nb.yml | 3 ++- config/locales/views/valuations/nl.yml | 1 + config/locales/views/valuations/pt-BR.yml | 1 + config/locales/views/valuations/ro.yml | 1 + config/locales/views/valuations/tr.yml | 3 ++- config/locales/views/valuations/zh-CN.yml | 1 + config/locales/views/valuations/zh-TW.yml | 1 + 13 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/views/valuations/_header.html.erb b/app/views/valuations/_header.html.erb index 2db8c8739..d4a376876 100644 --- a/app/views/valuations/_header.html.erb +++ b/app/views/valuations/_header.html.erb @@ -2,7 +2,8 @@ <%= tag.header class: "mb-4 space-y-1", id: dom_id(entry, :header) do %> - <%= entry.name %> + <% valuation = entry.entryable %> + <%= valuation.respond_to?(:opening_anchor?) && valuation.opening_anchor? ? t("valuations.show.opening_balance") : entry.name %>
diff --git a/app/views/valuations/_valuation.html.erb b/app/views/valuations/_valuation.html.erb index e377eda0f..003faf5fe 100644 --- a/app/views/valuations/_valuation.html.erb +++ b/app/views/valuations/_valuation.html.erb @@ -17,10 +17,12 @@ <%= render DS::FilledIcon.new(icon: icon, size: "md", hex_color: color, rounded: true) %>
- <%= link_to entry.name, - entry_path(entry), - data: { turbo_frame: "drawer", turbo_prefetch: false }, - class: "hover:underline" %> + <%= link_to( + valuation.opening_anchor? ? t("valuations.show.opening_balance") : entry.name, + entry_path(entry), + data: { turbo_frame: "drawer", turbo_prefetch: false }, + class: "hover:underline" + ) %>
diff --git a/config/locales/views/valuations/de.yml b/config/locales/views/valuations/de.yml index cf7a48000..fc799ab44 100644 --- a/config/locales/views/valuations/de.yml +++ b/config/locales/views/valuations/de.yml @@ -28,3 +28,4 @@ de: note_placeholder: Füge zusätzliche Details zu diesem Eintrag hinzu overview: Übersicht settings: Einstellungen + opening_balance: Eröffnungssaldo diff --git a/config/locales/views/valuations/en.yml b/config/locales/views/valuations/en.yml index f4a55767c..6a8e964a2 100644 --- a/config/locales/views/valuations/en.yml +++ b/config/locales/views/valuations/en.yml @@ -30,3 +30,4 @@ en: note_placeholder: Add any additional details about this entry overview: Overview settings: Settings + opening_balance: "Opening balance" diff --git a/config/locales/views/valuations/es.yml b/config/locales/views/valuations/es.yml index 9f1e6312c..cf0816266 100644 --- a/config/locales/views/valuations/es.yml +++ b/config/locales/views/valuations/es.yml @@ -30,3 +30,4 @@ es: note_placeholder: Añade cualquier detalle adicional sobre esta entrada overview: Resumen settings: Configuración + opening_balance: Saldo inicial diff --git a/config/locales/views/valuations/fr.yml b/config/locales/views/valuations/fr.yml index d8d59a104..ccd22d4af 100644 --- a/config/locales/views/valuations/fr.yml +++ b/config/locales/views/valuations/fr.yml @@ -28,3 +28,4 @@ fr: note_placeholder: Ajoutez tout détail supplémentaire à ce bilan overview: Aperçu settings: Paramètres + opening_balance: Solde d'ouverture diff --git a/config/locales/views/valuations/nb.yml b/config/locales/views/valuations/nb.yml index 5125b0071..f2d311307 100644 --- a/config/locales/views/valuations/nb.yml +++ b/config/locales/views/valuations/nb.yml @@ -27,4 +27,5 @@ nb: note_label: Notater note_placeholder: Legg til eventuelle tilleggsdetaljer om denne oppføringen overview: Oversikt - settings: Innstillinger \ No newline at end of file + settings: Innstillinger + opening_balance: Startsaldo \ No newline at end of file diff --git a/config/locales/views/valuations/nl.yml b/config/locales/views/valuations/nl.yml index 7bc507bc7..e84eb6865 100644 --- a/config/locales/views/valuations/nl.yml +++ b/config/locales/views/valuations/nl.yml @@ -28,3 +28,4 @@ nl: note_placeholder: Voeg eventuele aanvullende details toe over deze invoer overview: Overzicht settings: Instellingen + opening_balance: Beginsaldo diff --git a/config/locales/views/valuations/pt-BR.yml b/config/locales/views/valuations/pt-BR.yml index 41d90cad1..32b6504ab 100644 --- a/config/locales/views/valuations/pt-BR.yml +++ b/config/locales/views/valuations/pt-BR.yml @@ -28,3 +28,4 @@ pt-BR: note_placeholder: Adicione detalhes adicionais sobre esta entrada overview: Visão geral settings: Configurações + opening_balance: Saldo inicial diff --git a/config/locales/views/valuations/ro.yml b/config/locales/views/valuations/ro.yml index b607ba206..29c406faa 100644 --- a/config/locales/views/valuations/ro.yml +++ b/config/locales/views/valuations/ro.yml @@ -24,3 +24,4 @@ ro: note_placeholder: Adaugă orice detalii suplimentare despre această înregistrare overview: Prezentare generală settings: Setări + opening_balance: Sold inițial diff --git a/config/locales/views/valuations/tr.yml b/config/locales/views/valuations/tr.yml index 1eb75757b..461876e95 100644 --- a/config/locales/views/valuations/tr.yml +++ b/config/locales/views/valuations/tr.yml @@ -27,4 +27,5 @@ tr: note_label: Notlar note_placeholder: Bu girişle ilgili ek detaylar ekleyin overview: Genel Bakış - settings: Ayarlar \ No newline at end of file + settings: Ayarlar + opening_balance: Açılış bakiyesi diff --git a/config/locales/views/valuations/zh-CN.yml b/config/locales/views/valuations/zh-CN.yml index e6a3a37ec..2cc6bfc63 100644 --- a/config/locales/views/valuations/zh-CN.yml +++ b/config/locales/views/valuations/zh-CN.yml @@ -30,3 +30,4 @@ zh-CN: note_placeholder: 添加此记录的其他详细信息 overview: 概览 settings: 设置 + opening_balance: 初始余额 diff --git a/config/locales/views/valuations/zh-TW.yml b/config/locales/views/valuations/zh-TW.yml index b1a374afe..af39427d9 100644 --- a/config/locales/views/valuations/zh-TW.yml +++ b/config/locales/views/valuations/zh-TW.yml @@ -28,3 +28,4 @@ zh-TW: note_placeholder: 加入關於此紀錄的額外資訊 overview: 概覽 settings: 設定 + opening_balance: 初始餘額