GitLab ist wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht erreichbar.

Commit cae73b79 authored by jplang's avatar jplang

Adds locales:update task as a replacement for gloc:update.

git-svn-id: e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 88e80631
namespace :locales do
desc 'Updates language files based on en.yml content (only works for new top level keys).'
task :update do
dir = ENV['DIR'] || './config/locales'
en_strings = YAML.load(,'en.yml')))['en']
files = Dir.glob(File.join(dir,'fr.{yaml,yml}'))
files.each do |file|
puts "Updating file #{file}"
file_strings = YAML.load(
file_strings = file_strings[file_strings.keys.first]
missing_keys = en_strings.keys - file_strings.keys
next if missing_keys.empty?
puts "==> Missing #{missing_keys.size} keys (#{missing_keys.join(', ')})"
lang =, 'a')
missing_keys.each do |key|
{key => en_strings[key]}.to_yaml.each_line do |line|
next if line =~ /^---/ || line.empty?
puts " #{line}"
lang << " #{line}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment