The personal finance app for everyone (by everyone)
Ruby
fix(i18n): localize transaction bill links (#3406)
Thomas Steibl947fe8327c6e
diff --git a/config/locales/views/transactions/de.yml b/config/locales/views/transactions/de.ymlindex 1e98ba8af1..dcd396a4db 100644--- a/config/locales/views/transactions/de.yml+++ b/config/locales/views/transactions/de.yml@@ -69,8 +69,12 @@ de:keep_both: Nein, beide behaltenloan_payment: Kreditratemark_recurring: Als wiederkehrend markieren+ create_bill: Rechnung hinzufügenmark_recurring_subtitle: Erfasse das als wiederkehrende Transaktion. Die Schwankungsbreite des Betrags wird automatisch aus ähnlichen Transaktionen der letzten 6 Monate berechnet.mark_recurring_title: Wiederkehrende Transaktion+ applied_to_title: Damit bezahlte Rechnungen+ applied_to_detail: "%{amount} für die am %{date} fällige Rechnung"+ applied_to_unreviewed: Prüfung erforderlichmemo: Memomerge_duplicate: Ja, zusammenführenopen_matcher: Zuordnung öffnendiff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rbindex 4dcfe010c7..905575daca 100644--- a/test/controllers/transactions_controller_test.rb+++ b/test/controllers/transactions_controller_test.rb@@ -11,7 +11,8 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTest# Bills has always linked out to transactions. Until now nothing linked back,# so a transaction that settled a bill was a dead end. The link-back is part# of the preview-gated bills surface, so the viewer needs the flag.- test "a transaction shows the bill it paid, and links to it" do+ test "a German transaction shows the bill it paid with localized copy" do+ @user.update!(locale: "de")@user.update!(preferences: (@user.preferences || {}).merge("preview_features_enabled" => true))series = @user.family.recurring_transactions.create!(account: accounts(:depository), name: "Watson Property", amount: 2000,@@ -32,6 +33,20 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTestassert_response :successassert_match "Watson Property", response.bodyassert_match bill_path(series), response.body, "the bill must be reachable from the transaction"++ translations = {+ "transactions.show.create_bill" => "Rechnung hinzufügen",+ "transactions.show.applied_to_title" => "Damit bezahlte Rechnungen",+ "transactions.show.applied_to_detail" => "%{amount} für die am %{date} fällige Rechnung",+ "transactions.show.applied_to_unreviewed" => "Prüfung erforderlich"+ }+ translations.each do |key, text|+ assert_equal text, I18n.t(key, locale: :de, fallback: false)+ end++ assert_match translations.fetch("transactions.show.create_bill"), response.body+ assert_match translations.fetch("transactions.show.applied_to_title"), response.body+ assert_match(/für die am .* fällige Rechnung/, response.body)endtest "the bill link-back stays hidden without preview access" do