From f50376b147118906001b67dd44e93e1f4fe61959 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Thu, 4 May 2023 21:24:13 +0200 Subject: [PATCH] Restrict available locales to those defined by Redmine itself Previously, we would also offer (partial) locales which are only defined elsewhere (e.g. included gems or plugins). --- lib/redmine/i18n.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index 805e3c61ca..7010437fd7 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -161,7 +161,10 @@ class Backend < ::I18n::Backend::Simple module Implementation # Get available locales from the translations filenames def available_locales - @available_locales ||= ::I18n.load_path.map {|path| File.basename(path, '.*')}.uniq.sort.map(&:to_sym) + @available_locales ||= begin + redmine_locales = Dir[Rails.root / 'config' / 'locales' / '*.yml'].map { |f| File.basename(f, '.yml').to_sym } + super & redmine_locales + end end end -- 2.39.2