summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-05-10 00:27:32 +0000
committerGo MAEDA <maeda@farend.jp>2023-05-10 00:27:32 +0000
commit3a75a7ecc511a8573e2a11f4c3536082471f8d67 (patch)
treea78c2325ed4ae7219c25ae73f9ed815c582149c5 /lib
parentbf239fae8a7c11d7f393e0a484d2031239fed10c (diff)
downloadredmine-3a75a7ecc511a8573e2a11f4c3536082471f8d67.tar.gz
redmine-3a75a7ecc511a8573e2a11f4c3536082471f8d67.zip
Restrict available locales to those defined by Redmine itself (#38529).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@22237 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/i18n.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
index 805e3c61c..7010437fd 100644
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -161,7 +161,10 @@ module Redmine
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