Handle kinda sorta not there Transifex locales

This commit is contained in:
Jason 2016-03-17 22:18:06 -05:00
parent 279803d052
commit 6dcbf1bef8

View File

@ -28,7 +28,12 @@ project.languages.each do |language|
project.resources.each do |resource| project.resources.each do |resource|
c = resource.translation(code).content c = resource.translation(code).content
file_name = "#{dir_name}/#{resource.name}" file_name = "#{dir_name}/#{resource.name}"
completed = resource.stats(code).completed begin
completed = resource.stats(code).completed
rescue Transifex::NotFound
puts "#{code} not found."
next
end
has_content ||= completed != "0%" has_content ||= completed != "0%"
puts "Writing resource #{file_name}, #{completed} complete." puts "Writing resource #{file_name}, #{completed} complete."
File.open(file_name, 'w') { |file| file.write(c) } File.open(file_name, 'w') { |file| file.write(c) }