diff options
author | Go MAEDA <maeda@farend.jp> | 2023-10-20 02:55:03 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-10-20 02:55:03 +0000 |
commit | 3c677a82c7e8eec81fc78b1da83bca289feca59e (patch) | |
tree | 3c98c2b8adf760599434ffc6a16f6a38ed5a4588 /lib/tasks | |
parent | 225156861b3e57238cee423902ae711d95f39b13 (diff) | |
download | redmine-3c677a82c7e8eec81fc78b1da83bca289feca59e.tar.gz redmine-3c677a82c7e8eec81fc78b1da83bca289feca59e.zip |
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
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/locales.rake | 6 |
1 files changed, 3 insertions, 3 deletions
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}..." |