mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Fixes the language codes in the pull_translations script
This commit is contained in:
parent
6447c6c81d
commit
dc8759962b
1 changed files with 7 additions and 3 deletions
|
@ -51,10 +51,14 @@ YML_DIRS = ['config/locales',
|
|||
['client', 'server'].each do |base|
|
||||
YML_DIRS.each do |dir|
|
||||
Dir.glob(File.expand_path("../../#{dir}/#{base}.*.yml", __FILE__)).each do |file_name|
|
||||
contents = File.readlines(file_name)
|
||||
language = File.basename(file_name).match(Regexp.new("#{base}\\.([^\\.]*)\\.yml"))[1]
|
||||
|
||||
lines = File.readlines(file_name)
|
||||
lines.collect! {|line| line =~ /^[a-z_]+:$/i ? "#{language}:" : line}
|
||||
|
||||
File.open(file_name, 'w+') do |f|
|
||||
f.puts(YML_FILE_COMMENTS, '') unless contents[0][0] == '#'
|
||||
f.puts contents
|
||||
f.puts(YML_FILE_COMMENTS, '') unless lines[0][0] == '#'
|
||||
f.puts(lines)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue