lib/cherrypick/services/locales.rb
def read
          result = {}
      
          Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|
            yml = YAML::load(IO.read(file))
            hash = @locale ? yml.to_hash[@locale] : yml.to_hash
            result.deep_merge! hash unless hash.nil?
          end

          result
        end
# Get all localization files from config/locales and convert them into hash
# If locale is provided, keep only that one and remove iso_code from root
Get all localization files from config/locales and convert them into hash
If locale is provided, keep only that one and remove iso_code from root
Get all localization files from config / locales and convert them into hash If locale is provided keep only that one and remove iso_code from root
def read
          result = {}
          Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|
            yml = YAML::load(IO.read(file))
            hash = @locale ? yml.to_hash[@locale] : yml.to_hash
            result.deep_merge! hash unless hash.nil?
          end
          result
        end
def read result = { } Dir [ File . join ( Rails . root . join ( 'config/locales' ) , '*.yml' ) ] . sort . each do | file | yml = YAML :: load ( IO . read ( file ) ) hash = @locale ? yml . to_hash [ @locale ] : yml . to_hash result . deep_merge! hash unless hash . nil? end result end
Get all localization files from config/locales and convert them into hash
If locale is provided, keep only that one and remove iso_code from root
Get all localization files from config / locales and convert them into hash If locale is provided keep only that one and remove iso_code from root