Skip to content

armgit / sure

Public Imported from GitHub
0

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.yml
index 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 behalten
loan_payment: Kreditrate
mark_recurring: Als wiederkehrend markieren
+ create_bill: Rechnung hinzufügen
mark_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 erforderlich
memo: Memo
merge_duplicate: Ja, zusammenführen
open_matcher: Zuordnung öffnen
diff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rb
index 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::IntegrationTest
assert_response :success
assert_match "Watson Property", response.body
assert_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)
end
test "the bill link-back stays hidden without preview access" do