]> source.dussan.org Git - redmine.git/commitdiff
Restrict available locales to those defined by Redmine itself (#38529).
authorGo MAEDA <maeda@farend.jp>
Wed, 10 May 2023 00:27:32 +0000 (00:27 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 10 May 2023 00:27:32 +0000 (00:27 +0000)
Patch by  Holger Just.

git-svn-id: https://svn.redmine.org/redmine/trunk@22237 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/i18n.rb

index 805e3c61ca84f625719ae7373d623a72734dcd5a..7010437fd71cedcac89cd4256a29bfc787becebe 100644 (file)
@@ -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