Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Use absolute keys for the four UI component strings that never resolved (#3808)

Guillem Arias Faustef2785fe5a1d3
diff --git a/app/components/UI/account/activity_date.html.erb b/app/components/UI/account/activity_date.html.erb
index 67758b8a18..1b2e25a537 100644
--- a/app/components/UI/account/activity_date.html.erb
+++ b/app/components/UI/account/activity_date.html.erb
@@ -21,7 +21,7 @@
<div class="flex items-center gap-4">
<div class="flex items-center gap-2">
<span class="font-medium privacy-sensitive"><%= end_balance_money.format %></span>
- <%= render DS::Tooltip.new(text: t(".balance_tooltip"), placement: "left", size: "sm", as: :span) %>
+ <%= render DS::Tooltip.new(text: t("UI.account.activity_date.balance_tooltip"), placement: "left", size: "sm", as: :span) %>
</div>
<%= helpers.icon "chevron-down", class: "group-open:rotate-180" %>
</div>
@@ -32,7 +32,7 @@
<% if balance %>
<%= render UI::Account::BalanceReconciliation.new(balance: balance, account: account) %>
<% else %>
- <p class="text-sm text-secondary"><%= t(".no_balance_data") %></p>
+ <p class="text-sm text-secondary"><%= t("UI.account.activity_date.no_balance_data") %></p>
<% end %>
</div>
</details>
diff --git a/app/components/UI/account/activity_feed.html.erb b/app/components/UI/account/activity_feed.html.erb
index 8639ab62a5..65bc3a6286 100644
--- a/app/components/UI/account/activity_feed.html.erb
+++ b/app/components/UI/account/activity_feed.html.erb
@@ -105,7 +105,7 @@
<% end %>
<%= button_tag type: "button",
id: "toggle-checkboxes-button",
- aria: { label: t(".toggle_selection_checkboxes") },
+ aria: { label: t("UI.account.activity_feed.toggle_selection_checkboxes") },
class: "lg:hidden font-medium whitespace-nowrap inline-flex items-center gap-1 rounded-lg px-3 py-2 text-sm text-primary border border-secondary hover:bg-surface-hover",
data: {
action: "click->checkbox-toggle#toggle",
diff --git a/app/components/UI/period_picker.html.erb b/app/components/UI/period_picker.html.erb
index 2cc66922e8..6ab510276a 100644
--- a/app/components/UI/period_picker.html.erb
+++ b/app/components/UI/period_picker.html.erb
@@ -2,7 +2,7 @@
<% menu.with_button(
type: "button",
class: "inline-flex items-center gap-1.5 bg-container border border-secondary font-medium rounded-lg pl-3 pr-2 py-2 text-sm cursor-pointer text-primary hover:bg-container-inset-hover focus:outline-hidden focus:ring-0",
- aria: { label: t(".aria_label", period: selected_label, default: "Time period: %{period}") }
+ aria: { label: t("UI.period_picker.aria_label", period: selected_label) }
) do %>
<span class="whitespace-nowrap"><%= selected_label %></span>
<%= helpers.icon("chevron-down", size: "sm") %>
diff --git a/test/components/UI/period_picker_test.rb b/test/components/UI/period_picker_test.rb
index e3ec67bb3a..02e777ee9f 100644
--- a/test/components/UI/period_picker_test.rb
+++ b/test/components/UI/period_picker_test.rb
@@ -36,6 +36,15 @@ class UI::PeriodPickerTest < ViewComponent::TestCase
assert_selector "button[aria-label='Time period: #{label}']"
end
+ test "trigger accessible name follows the locale" do
+ I18n.with_locale(:de) do
+ render_inline(UI::PeriodPicker.new(selected: "last_90_days", url: "/"))
+
+ label = Period.from_key("last_90_days").label_short
+ assert_selector "button[aria-label='Zeitraum: #{label}']"
+ end
+ end
+
test "extra_params are merged into every option href" do
render_inline(UI::PeriodPicker.new(
selected: "last_30_days",
diff --git a/test/controllers/accounts_controller_test.rb b/test/controllers/accounts_controller_test.rb
index 8636c5e3be..0f8fe28138 100644
--- a/test/controllers/accounts_controller_test.rb
+++ b/test/controllers/accounts_controller_test.rb
@@ -170,6 +170,13 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
assert_select "a[role='menuitemradio'][aria-checked='true'][href*='start_date=']", count: 1
end
+ test "show renders without missing translations" do
+ get account_url(@account)
+
+ assert_response :success
+ assert_empty response.body.scan(/translation missing: [\w.]+/).uniq
+ end
+
test "sync all requests fresh Plaid transactions before syncing the family" do
sequence = sequence("manual sync all")
Family.any_instance