mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #3432 from gschlager/transifex
Fixes the language codes in the pull_translations script
This commit is contained in:
commit
942f18143c
1 changed files with 7 additions and 3 deletions
|
@ -51,10 +51,14 @@ YML_DIRS = ['config/locales',
|
||||||
['client', 'server'].each do |base|
|
['client', 'server'].each do |base|
|
||||||
YML_DIRS.each do |dir|
|
YML_DIRS.each do |dir|
|
||||||
Dir.glob(File.expand_path("../../#{dir}/#{base}.*.yml", __FILE__)).each do |file_name|
|
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|
|
File.open(file_name, 'w+') do |f|
|
||||||
f.puts(YML_FILE_COMMENTS, '') unless contents[0][0] == '#'
|
f.puts(YML_FILE_COMMENTS, '') unless lines[0][0] == '#'
|
||||||
f.puts contents
|
f.puts(lines)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue