The personal finance app for everyone (by everyone)
Ruby
Translate the Enable Banking account setup modal (#5352)
Sailing7452ffbdd06a62
diff --git a/app/controllers/enable_banking_items_controller.rb b/app/controllers/enable_banking_items_controller.rbindex 2bb682e3ad..ae4ce32763 100644--- a/app/controllers/enable_banking_items_controller.rb+++ b/app/controllers/enable_banking_items_controller.rb@@ -318,37 +318,39 @@ class EnableBankingItemsController < ApplicationControllerdef setup_accounts@enable_banking_accounts = @enable_banking_item.enable_banking_accounts.needs_setup- @account_type_options = [- [ "Skip this account", "skip" ],- [ "Checking or Savings Account", "Depository" ],- [ "Credit Card", "CreditCard" ],- [ "Investment Account", "Investment" ],- [ "Loan or Mortgage", "Loan" ],- [ "Other Asset", "OtherAsset" ]- ]+ account_type_keys = {+ "depository" => "Depository",+ "credit_card" => "CreditCard",+ "investment" => "Investment",+ "loan" => "Loan",+ "other_asset" => "OtherAsset"+ }++ @account_type_options = [ [ t(".account_types.skip"), "skip" ] ] ++ account_type_keys.map { |key, type| [ t(".account_types.#{key}"), type ] }@subtype_options = {"Depository" => {- label: "Account Subtype:",- options: Depository::SUBTYPES.map { |k, v| [ v[:long], k ] }+ label: t(".subtype_labels.depository"),+ options: Depository.subtype_options_for_select},"CreditCard" => {label: "",options: [],- message: "Credit cards will be automatically set up as credit card accounts."+ message: t(".subtype_messages.credit_card")},"Investment" => {- label: "Investment Type:",- options: Investment::SUBTYPES.map { |k, v| [ v[:long], k ] }+ label: t(".subtype_labels.investment"),+ options: Investment.subtype_options_for_select},"Loan" => {- label: "Loan Type:",- options: Loan::SUBTYPES.map { |k, v| [ v[:long], k ] }+ label: t(".subtype_labels.loan"),+ options: Loan.subtype_options_for_select},"OtherAsset" => {label: nil,options: [],- message: "Other assets will be set up as general assets."+ message: t(".subtype_messages.other_asset")}}diff --git a/app/views/enable_banking_items/_subtype_select.html.erb b/app/views/enable_banking_items/_subtype_select.html.erbindex c5969396c5..0ad71a8d70 100644--- a/app/views/enable_banking_items/_subtype_select.html.erb+++ b/app/views/enable_banking_items/_subtype_select.html.erb@@ -4,7 +4,7 @@class: "block text-sm font-medium text-primary mb-2" %><% selected_value = enable_banking_account.suggested_subtype.presence || "" %><%= select_tag "account_subtypes[#{enable_banking_account.id}]",- options_for_select([["Select #{account_type == 'Depository' ? 'subtype' : 'type'}", ""]] + subtype_config[:options], selected_value),+ options_for_select([[t("enable_banking_items.setup_accounts.#{account_type == 'Depository' ? 'select_subtype' : 'select_type'}"), ""]] + subtype_config[:options], selected_value),{ class: "appearance-none bg-container border border-primary rounded-md px-3 py-2 text-sm leading-6 text-primary focus:border-primary focus:ring-1 focus:ring-primary focus:outline-none w-full" } %><% else %><p class="text-sm text-secondary"><%= subtype_config[:message] %></p>diff --git a/config/locales/views/enable_banking_items/de.yml b/config/locales/views/enable_banking_items/de.ymlindex 8233dded84..3da9d32005 100644--- a/config/locales/views/enable_banking_items/de.yml+++ b/config/locales/views/enable_banking_items/de.yml@@ -103,6 +103,22 @@ de:unlink_to_move: Um ein anderes Konto zu verknüpfen, löse die bestehende Verknüpfung zuerst über das Aktionsmenü des Kontos.setup_accounts:account_type_label: 'Kontoart:'+ account_types:+ credit_card: Kreditkarte+ depository: Giro- oder Sparkonto+ investment: Depot/Anlagekonto+ loan: Darlehen oder Baufinanzierung+ other_asset: Sonstiges Vermögen+ skip: Dieses Konto überspringen+ select_subtype: Kontotyp auswählen+ select_type: Art auswählen+ subtype_labels:+ depository: 'Kontotyp:'+ investment: 'Anlagetyp:'+ loan: 'Darlehensart:'+ subtype_messages:+ credit_card: Kreditkarten werden automatisch als Kreditkartenkonten eingerichtet.+ other_asset: Sonstiges Vermögen wird als allgemeiner Vermögenswert eingerichtet.balance: Saldocancel: Abbrechenchoose_account_type: 'Wähl für jedes Enable-Banking-Konto die passende Kontoart:'diff --git a/config/locales/views/enable_banking_items/en.yml b/config/locales/views/enable_banking_items/en.ymlindex 1a9a666f51..a926c16058 100644--- a/config/locales/views/enable_banking_items/en.yml+++ b/config/locales/views/enable_banking_items/en.yml@@ -71,11 +71,27 @@ en:sync_start_date_label: "Start syncing transactions from:"sync_start_date_help: Optional. Leave it blank to import as much history as your bank provides; how far back that goes depends on the bank. If you pick a date, transactions before it are not imported.account_type_label: "Account Type:"+ account_types:+ skip: Skip this account+ depository: Checking or Savings Account+ credit_card: Credit Card+ investment: Investment Account+ loan: Loan or Mortgage+ other_asset: Other Asset+ subtype_labels:+ depository: "Account Subtype:"+ investment: "Investment Type:"+ loan: "Loan Type:"+ subtype_messages:+ credit_card: Credit cards will be automatically set up as credit card accounts.+ other_asset: Other assets will be set up as general assets.balance: Balancecreate_accounts: Create Accountscreating_accounts: Creating Accounts...cancel: Cancelpsd2_savings_notice: "Note: Some regulated French savings accounts (Livret A, PEL, LEP, LDDS) may have limited or no access over Open Banking (PSD2). If a savings account is missing, you can add it manually."+ select_subtype: Select subtype+ select_type: Select typenew:link_enable_banking_title: Link Enable Bankingsession_expired: Session expired - re-authorization requireddiff --git a/config/locales/views/loans/de.yml b/config/locales/views/loans/de.ymlindex 14ae159aa6..efdd9af6d2 100644--- a/config/locales/views/loans/de.yml+++ b/config/locales/views/loans/de.yml@@ -54,6 +54,28 @@ de:term: Laufzeittype: Typunknown: Unbekannt+ subtypes:+ auto:+ long: Autokredit+ short: Autokredit+ business:+ long: Geschäftskredit+ short: Geschäftskredit+ home_equity:+ long: Darlehen gegen Immobilienbeleihung+ short: Immobilienbeleihung+ line_of_credit:+ long: Kreditlinie (Rahmenkredit)+ short: Kreditrahmen+ mortgage:+ long: Baufinanzierung (Hypothek)+ short: Baufinanzierung+ other:+ long: Sonstiges Darlehen+ short: Sonstiges Darlehen+ student:+ long: Studienkredit+ short: Studienkredittabs:extra_repayments:amount_label: Sondertilgungdiff --git a/config/locales/views/loans/en.yml b/config/locales/views/loans/en.ymlindex abfd82f0b6..6b9fb46e20 100644--- a/config/locales/views/loans/en.yml+++ b/config/locales/views/loans/en.yml@@ -54,6 +54,28 @@ en:term: Termtype: Typeunknown: Unknown+ subtypes:+ auto:+ long: Auto Loan+ short: Auto Loan+ business:+ long: Business Loan+ short: Business Loan+ home_equity:+ long: Home Equity Loan+ short: Home Equity+ line_of_credit:+ long: Line of Credit+ short: Line of Credit+ mortgage:+ long: Mortgage+ short: Mortgage+ other:+ long: Other Loan+ short: Other Loan+ student:+ long: Student Loan+ short: Student Loantabs:extra_repayments:amount_label: Extra repaymentdiff --git a/test/controllers/enable_banking_items_controller_test.rb b/test/controllers/enable_banking_items_controller_test.rbindex e40959165b..37895c8c80 100644--- a/test/controllers/enable_banking_items_controller_test.rb+++ b/test/controllers/enable_banking_items_controller_test.rb@@ -656,6 +656,21 @@ class EnableBankingItemsControllerTest < ActionDispatch::IntegrationTestendend+ test "setup modal shows account types and subtypes in the user's language" do+ @item.enable_banking_accounts.create!(name: "Checking", uid: "eb_setup_1", currency: "EUR", current_balance: 0)++ get setup_accounts_enable_banking_item_url(@item, locale: :de)++ assert_response :success+ I18n.with_locale(:de) do+ assert_select "option[value=Depository]", text: I18n.t("enable_banking_items.setup_accounts.account_types.depository")+ assert_select "option[value=checking]", text: Depository.long_subtype_label_for("checking")+ assert_select "option[value=mortgage]", text: Loan.long_subtype_label_for("mortgage")+ assert_select "label", text: I18n.t("enable_banking_items.setup_accounts.subtype_labels.loan")+ end+ assert_no_match(/Checking or Savings Account|Loan or Mortgage|Account Subtype:/, response.body)+ end+test "setup modal shows a start date that is already set" do@item.update!(sync_start_date: Date.new(2024, 1, 15))@item.enable_banking_accounts.create!(name: "Checking", uid: "eb_setup_1", currency: "EUR", current_balance: 0)