The personal finance app for everyone (by everyone)
Ruby
fix(i18n): localize budget category dates (#3315)
Thomas Steibla2b932921057
diff --git a/app/views/budget_categories/show.html.erb b/app/views/budget_categories/show.html.erbindex 96e04997c8..7bec0188f0 100644--- a/app/views/budget_categories/show.html.erb+++ b/app/views/budget_categories/show.html.erb@@ -31,7 +31,7 @@<dl class="space-y-3 px-3 py-2"><div class="flex items-center justify-between text-sm"><dt class="text-secondary">- <%= t(".spending", date: @budget_category.budget.start_date.strftime("%b %Y")) %>+ <%= t(".spending", date: l(@budget_category.budget.start_date, format: "%b %Y")) %></dt><dd class="text-primary font-medium privacy-sensitive"><%= format_money @budget_category.actual_spending_money %>@@ -113,7 +113,7 @@<div class="flex justify-between w-full"><div><p class="text-secondary text-xs uppercase">- <%= transaction.entry.date.strftime("%b %d") %>+ <%= l(transaction.entry.date, format: :short) %></p><%= link_to transaction.entry.name,transactions_path,diff --git a/test/controllers/budget_categories_controller_test.rb b/test/controllers/budget_categories_controller_test.rbindex 77812c5d8a..dbd581c5cb 100644--- a/test/controllers/budget_categories_controller_test.rb+++ b/test/controllers/budget_categories_controller_test.rb@@ -64,6 +64,36 @@ class BudgetCategoriesControllerTest < ActionDispatch::IntegrationTestassert_select "#{uncategorized_form_selector} p.text-secondary.privacy-sensitive", text: /\/m avg/end+ test "show localizes the abbreviated budget month and recent transaction dates" do+ ensure_tailwind_build+ users(:family_admin).update!(locale: "de")+ @budget.update!(start_date: Date.new(2026, 3, 1), end_date: Date.new(2026, 3, 31))+ create_transaction(+ date: Date.new(2026, 3, 7),+ account: accounts(:depository),+ amount: 42,+ category: @parent_category,+ name: "Synthetic March expense"+ )++ get budget_budget_category_path(@budget, @parent_budget_category)++ assert_response :success+ assert_select "dt", text: "Ausgaben Mär 2026"+ assert_select "p.text-secondary.text-xs.uppercase", text: "7. Mär"+ end++ test "show preserves the abbreviated English budget month" do+ ensure_tailwind_build+ users(:family_admin).update!(locale: "en")+ @budget.update!(start_date: Date.new(2026, 3, 1), end_date: Date.new(2026, 3, 31))++ get budget_budget_category_path(@budget, @parent_budget_category)++ assert_response :success+ assert_select "dt", text: "Mar 2026 spending"+ end+test "updating a subcategory adjusts the parent budget by the same delta" doassert_changes -> { @parent_budget_category.reload.budgeted_spending.to_f }, from: 500.0, to: 550.0 dopatch budget_budget_category_path(@budget, @electric_budget_category),