mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:05:24 +08:00
Merge pull request #3432 from gschlager/transifex
Fixes the language codes in the pull_translations script
This commit is contained in:
commit
942f18143c
|
@ -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 New Issue
Block a user