From 589025cfa6e000345758e51e71f4a85c4c0b13af Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Thu, 25 Apr 2024 12:12:26 -0400 Subject: [PATCH 1/2] Clean up i18n translations --- .../accounts/_account_valuation_list.html.erb | 6 +++--- app/views/accounts/show.html.erb | 6 +++--- app/views/layouts/application.html.erb | 2 +- ...modal.html.erb => _confirm_modal.html.erb} | 6 +++--- config/locales/views/account/en.yml | 17 ++++++++++++++++ config/locales/views/shared/en.yml | 20 ++----------------- 6 files changed, 29 insertions(+), 28 deletions(-) rename app/views/shared/{_custom_confirm_modal.html.erb => _confirm_modal.html.erb} (79%) diff --git a/app/views/accounts/_account_valuation_list.html.erb b/app/views/accounts/_account_valuation_list.html.erb index 3e0833a32b3..8b5cea33215 100644 --- a/app/views/accounts/_account_valuation_list.html.erb +++ b/app/views/accounts/_account_valuation_list.html.erb @@ -40,9 +40,9 @@ <% end %> <%= link_to valuation_path(valuation.original), data: { turbo_method: :delete, - turbo_confirm: { title: t("custom_turbo_confirm.history.title"), - body: t("custom_turbo_confirm.history.body_html"), - accept: t("custom_turbo_confirm.history.accept") } }, + turbo_confirm: { title: t(".confirm_title"), + body: t(".confirm_body_html"), + accept: t(".confirm_accept") } }, class: "text-red-600 flex gap-1 items-center hover:bg-gray-50 rounded-md p-2" do %> <%= lucide_icon("trash-2", class: "w-5 h-5 shrink-0") %> Delete entry diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index f2b041dfce6..4e648d9a54f 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -26,9 +26,9 @@ class: "block w-full py-2 text-red-600 hover:text-red-800 flex items-center", data: { turbo_confirm: { - title: t("custom_turbo_confirm.account_destroy.title"), - body: t("custom_turbo_confirm.account_destroy.body_html"), - accept: t("custom_turbo_confirm.account_destroy.accept", name: @account.name) + title: t(".confirm_title"), + body: t(".confirm_body_html"), + accept: t(".confirm_accept", name: @account.name) } } do %> <%= lucide_icon("trash-2", class: "w-5 h-5 mr-2") %> Delete account diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e2a7d01f962..30f5c32cdab 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -38,7 +38,7 @@ <%= turbo_frame_tag "modal" %> - <%= render "shared/custom_confirm_modal" %> + <%= render "shared/confirm_modal" %> <%= render "shared/upgrade_notification" %> <% if self_hosted? %>
diff --git a/app/views/shared/_custom_confirm_modal.html.erb b/app/views/shared/_confirm_modal.html.erb similarity index 79% rename from app/views/shared/_custom_confirm_modal.html.erb rename to app/views/shared/_confirm_modal.html.erb index 9c40e047a57..8eb7e86b7a9 100644 --- a/app/views/shared/_custom_confirm_modal.html.erb +++ b/app/views/shared/_confirm_modal.html.erb @@ -2,15 +2,15 @@
-

<%= t("custom_turbo_confirm.default.title") %>

+

<%= t(".title") %>

- <%= t("custom_turbo_confirm.default.body_html") %> + <%= t(".body_html") %>
- +
diff --git a/config/locales/views/account/en.yml b/config/locales/views/account/en.yml index 1aaf9cf5c72..6aaa511ce3d 100644 --- a/config/locales/views/account/en.yml +++ b/config/locales/views/account/en.yml @@ -1,6 +1,15 @@ --- en: accounts: + show: + confirm_title: Delete account? + confirm_accept: Delete "%{name}" + confirm_body_html: + "

By deleting this account, you will erase its value history, affecting + various aspects of your overall account. This action will have a direct impact + on your net worth calculations and the account graphs.


After + deletion, there is no way you'll be able to restore the account information + because you'll need to add it as a new account.

" create: success: New account created successfully destroy: @@ -22,3 +31,11 @@ en: success: Account sync started update: success: Account updated successfully + account_valuation_list: + confirm_title: Delete Entry? + confirm_accept: Delete entry + confirm_body_html: + "

Deleting this entry will remove it from the account’s history + which will impact different parts of your account. This includes the net worth + and account graphs.


The only way you’ll be able to add this entry + back is by re-entering it manually via a new entry

" diff --git a/config/locales/views/shared/en.yml b/config/locales/views/shared/en.yml index 191dfbc2089..8ae927845fa 100644 --- a/config/locales/views/shared/en.yml +++ b/config/locales/views/shared/en.yml @@ -1,26 +1,10 @@ --- en: - custom_turbo_confirm: - account_destroy: - accept: Delete "%{name}" - body_html: "

By deleting this account, you will erase its value history, affecting - various aspects of your overall account. This action will have a direct impact - on your net worth calculations and the account graphs.


After - deletion, there is no way you'll be able to restore the account information - because you'll need to add it as a new account.

" - title: Delete account? - default: + shared: + confirm_modal: accept: Confirm body_html: "

You will not be able to undo this decision

" title: Are you sure? - history: - accept: Delete entry - body_html: "

Deleting this entry will remove it from the account’s history - which will impact different parts of your account. This includes the net worth - and account graphs.


The only way you’ll be able to add this entry - back is by re-entering it manually via a new entry

" - title: Delete Entry? - shared: notification: dismiss: Dismiss upgrade_notification: From bb35be5046c5050f6b1fefa0c262a11df0a321c9 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Thu, 25 Apr 2024 12:15:43 -0400 Subject: [PATCH 2/2] Normalize translations --- config/locales/views/account/en.yml | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/config/locales/views/account/en.yml b/config/locales/views/account/en.yml index 6aaa511ce3d..82caf8a8d67 100644 --- a/config/locales/views/account/en.yml +++ b/config/locales/views/account/en.yml @@ -1,15 +1,13 @@ --- en: accounts: - show: - confirm_title: Delete account? - confirm_accept: Delete "%{name}" - confirm_body_html: - "

By deleting this account, you will erase its value history, affecting - various aspects of your overall account. This action will have a direct impact - on your net worth calculations and the account graphs.


After - deletion, there is no way you'll be able to restore the account information - because you'll need to add it as a new account.

" + account_valuation_list: + confirm_accept: Delete entry + confirm_body_html: "

Deleting this entry will remove it from the account’s + history which will impact different parts of your account. This includes the + net worth and account graphs.


The only way you’ll be able to add + this entry back is by re-entering it manually via a new entry

" + confirm_title: Delete Entry? create: success: New account created successfully destroy: @@ -25,17 +23,17 @@ en: placeholder: Example account name select_accountable_type: What would you like to add? title: Add an account + show: + confirm_accept: Delete "%{name}" + confirm_body_html: "

By deleting this account, you will erase its value history, + affecting various aspects of your overall account. This action will have a + direct impact on your net worth calculations and the account graphs.


After deletion, there is no way you'll be able to restore the account + information because you'll need to add it as a new account.

" + confirm_title: Delete account? summary: new: New account sync: success: Account sync started update: success: Account updated successfully - account_valuation_list: - confirm_title: Delete Entry? - confirm_accept: Delete entry - confirm_body_html: - "

Deleting this entry will remove it from the account’s history - which will impact different parts of your account. This includes the net worth - and account graphs.


The only way you’ll be able to add this entry - back is by re-entering it manually via a new entry

"