Project

General

Profile

Defect #42815 » 0001-Extract-available_locales-from-Implementation-module.patch

Marius BĂLTEANU, 2025-06-02 21:47

View differences:

Gemfile
19 19
gem "stimulus-rails", "~> 1.3"
20 20
gem "importmap-rails", "~> 2.0"
21 21
gem 'commonmarker', '~> 2.3.0'
22
gem "doorkeeper-i18n", "~> 5.2"
22 23

  
23 24
#  Ruby Standard Gems
24 25
gem 'csv', '~> 3.3.2'
lib/redmine/i18n.rb
177 177
    # Custom backend based on I18n::Backend::Simple with the following changes:
178 178
    # * available_locales are determined by looking at translation file names
179 179
    class Backend < ::I18n::Backend::Simple
180
      module Implementation
181
        # Get available locales from the translations filenames
182
        def available_locales
183
          @available_locales ||= begin
184
            redmine_locales = Dir[Rails.root / 'config' / 'locales' / '*.yml'].map { |f| File.basename(f, '.yml').to_sym }
185
            super & redmine_locales
186
          end
180
      # Get available locales from the translations filenames
181
      def available_locales
182
        @available_locales ||= begin
183
          redmine_locales = Dir[Rails.root / 'config' / 'locales' / '*.yml'].map { |f| File.basename(f, '.yml').to_sym }
184
          super & redmine_locales
187 185
        end
188 186
      end
189 187

  
(1-1/2)