Skip to content

armgit / sure

Public Imported from GitHub
0

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.rb
index 292d77cc8d..35562e68c3 100644
--- a/app/controllers/binance_items_controller.rb
+++ b/app/controllers/binance_items_controller.rb
@@ -223,7 +223,7 @@ class BinanceItemsController < ApplicationController
if 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")
end
end
diff --git a/config/locales/views/binance_items/de.yml b/config/locales/views/binance_items/de.yml
index 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: Abbrechen
creating: 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.yml
index 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: Cancel
creating: 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.rb
index 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::IntegrationTest
assert_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",