From 3c677a82c7e8eec81fc78b1da83bca289feca59e Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Fri, 20 Oct 2023 02:55:03 +0000 Subject: Replace `YAML.load` with `YAML.load_file` in locales.rake and improve error reporting for invalid YAML files (#39207). Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22356 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/locales.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/tasks') diff --git a/lib/tasks/locales.rake b/lib/tasks/locales.rake index 8ca224351..87295c31e 100644 --- a/lib/tasks/locales.rake +++ b/lib/tasks/locales.rake @@ -10,12 +10,12 @@ namespace :locales do task :update do dir = ENV['DIR'] || './config/locales' - en_strings = YAML.load(File.read(File.join(dir,'en.yml')))['en'] + en_strings = YAML.load_file(File.join(dir,'en.yml'))['en'] files = Dir.glob(File.join(dir,'*.{yaml,yml}')) files.sort.each do |file| puts "Updating file #{file}" - file_strings = YAML.load(File.read(file)) + file_strings = YAML.load_file(file) file_strings = file_strings[file_strings.keys.first] missing_keys = en_strings.keys - file_strings.keys @@ -39,7 +39,7 @@ namespace :locales do desc 'Checks interpolation arguments in locals against en.yml' task :check_interpolation do dir = ENV['DIR'] || './config/locales' - en_strings = YAML.load(File.read(File.join(dir,'en.yml')))['en'] + en_strings = YAML.load_file(File.join(dir,'en.yml'))['en'] files = Dir.glob(File.join(dir,'*.{yaml,yml}')) files.sort.each do |file| puts "parsing #{file}..." -- cgit v1.2.3