From d260346c17cae635363adef9e318c8fe2d47644c Mon Sep 17 00:00:00 2001 From: Kevin Everets Date: Wed, 8 Feb 2012 17:17:28 -0500 Subject: [PATCH] If there's not a default (developer language) translation, warn but still insert it --- lib/twine/stringsfile.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/twine/stringsfile.rb b/lib/twine/stringsfile.rb index 173ce87..e8ae7ca 100644 --- a/lib/twine/stringsfile.rb +++ b/lib/twine/stringsfile.rb @@ -120,13 +120,17 @@ module Twine f.puts "[[#{section.name}]]" section.rows.each do |row| + f.puts "\t[#{row.key}]" value = row.translations[dev_lang] - if value[0,1] == ' ' || value[-1,1] == ' ' || (value[0,1] == '`' && value[-1,1] == '`') - value = '`' + value + '`' + if !value + puts "Warning! #{row.key} does not exist in #{dev_lang}" + else + if value[0,1] == ' ' || value[-1,1] == ' ' || (value[0,1] == '`' && value[-1,1] == '`') + value = '`' + value + '`' + end + f.puts "\t\t#{dev_lang} = #{value}" end - f.puts "\t[#{row.key}]" - f.puts "\t\t#{dev_lang} = #{value}" if row.tags && row.tags.length > 0 tag_str = row.tags.join(',') f.puts "\t\ttags = #{tag_str}"