The personal finance app for everyone (by everyone)
Ruby
Localize invalid Binance sync start date (#3369)
Thomas Steibla5bb24840796
diff --git a/app/controllers/binance_items_controller.rb b/app/controllers/binance_items_controller.rbindex 292d77cc8d..35562e68c3 100644--- a/app/controllers/binance_items_controller.rb+++ b/app/controllers/binance_items_controller.rb@@ -223,7 +223,7 @@ class BinanceItemsController < ApplicationControllerif parsed_date.present? && parsed_date <= Date.current@binance_item.update!(sync_start_date: parsed_date)else- flash.now[:alert] = "Sync start date must be a valid date in the past."+ flash.now[:alert] = t(".invalid_sync_start_date")endenddiff --git a/config/locales/views/binance_items/de.yml b/config/locales/views/binance_items/de.ymlindex 288ff74cdf..30dabf9dd7 100644--- a/config/locales/views/binance_items/de.yml+++ b/config/locales/views/binance_items/de.yml@@ -22,6 +22,7 @@ de:cancel: Abbrechencreating: Importiere...complete_account_setup:+ invalid_sync_start_date: Wähl ein gültiges Startdatum für die Synchronisierung, das nicht in der Zukunft liegt.success:one: "%{count} Konto importiert"other: "%{count} Konten importiert"diff --git a/config/locales/views/binance_items/en.yml b/config/locales/views/binance_items/en.ymlindex ae3bd298a1..b3cad536a3 100644--- a/config/locales/views/binance_items/en.yml+++ b/config/locales/views/binance_items/en.yml@@ -21,6 +21,7 @@ en:cancel: Cancelcreating: Importing...complete_account_setup:+ invalid_sync_start_date: Sync start date must be a valid date in the past.success:one: "Imported %{count} account"other: "Imported %{count} accounts"diff --git a/test/controllers/binance_items_controller_test.rb b/test/controllers/binance_items_controller_test.rbindex 451705428d..d8bdc8e891 100644--- a/test/controllers/binance_items_controller_test.rb+++ b/test/controllers/binance_items_controller_test.rb@@ -96,6 +96,20 @@ class BinanceItemsControllerTest < ActionDispatch::IntegrationTestassert_equal "Sync start date must be a valid date in the past.", flash[:alert]end+ test "complete_account_setup localizes an invalid sync_start_date in German" do+ user = users(:family_admin)+ user.update!(locale: "de")+ sign_in user++ post complete_account_setup_binance_item_url(@binance_item), params: {+ selected_accounts: [],+ sync_start_date: (Date.current + 2.days).to_s+ }++ assert_equal "Wähl ein gültiges Startdatum für die Synchronisierung, das nicht in der Zukunft liegt.", flash[:alert]+ assert I18n.exists?("binance_items.complete_account_setup.invalid_sync_start_date", :de, fallback: false)+ end+test "complete_account_setup with no selection shows message" do@binance_item.binance_accounts.create!(name: "Spot Portfolio",