diff --git a/localize/poconvert.rb b/localize/poconvert.rb index 882f742..8a047df 100755 --- a/localize/poconvert.rb +++ b/localize/poconvert.rb @@ -363,6 +363,7 @@ module PoConvertModule self.items[l_key] = {} unless items.has_key?(l_key) self.items[l_key][num_case] = {} self.items[l_key][num_case][:comment] = comment + self.items[l_key][num_case][:fuzzy] = ( comment =~ /\(fuzzy\)/i ) != nil self.items[l_key][num_case][:case] = num_case self.items[l_key][num_case][:if_group] = nil # Reconstitute Hex Escapes @@ -370,7 +371,7 @@ module PoConvertModule line.lstrip.gsub(/\\x(..)/) { |g| [$1.hex].pack('c*').force_encoding('UTF-8') } end # Eliminate C double-double-quotes. - tmp = tmp.join.gsub(/""/) { |g| } + tmp = tmp.join.gsub(/(? 0 + report << "#, #{attribs.join(', ')}\n" end + report << "msgctxt \"#{key.to_s}\"\n" # Handle the untranslated strings, with the possibility that there @@ -779,7 +787,7 @@ msgstr "" po_content.items.each do |key, value| value.each_value do |item_entry| item_entry[:if_group] = lang_en.items[key]['0'][:if_group] - item_entry[:comment] = lang_en.items[key]['0'][:comment] + item_entry[:comment] = force_comments ? lang_en.items[key]['0'][:comment] : nil end end @@ -1083,6 +1091,10 @@ Complete Help: :type => :boolean, :desc => 'Specifies that the generated file contain hex escaped characters.', :aliases => '-h' + option :force_comments, + :type =>:boolean, + :desc => 'Forces comments into the header file. Base language_en.h always has comments.', + :aliases => '-f' desc 'msgfmt ', 'Creates a Tidy header H file from the given PO file.' long_desc <<-LONG_DESC Creates a Tidy header H file from the specified PO file, @@ -1104,6 +1116,7 @@ Complete Help: args.each do |input_file| converter = PoConverter.new converter.plaintext = !options[:hex] + converter.force_comments = options[:force_comments] set_options error_count = converter.convert_to_h( input_file, options[:baselang] ) ? error_count : error_count + 1 end diff --git a/src/language.c b/src/language.c index 9477fcc..22ca6fa 100644 --- a/src/language.c +++ b/src/language.c @@ -622,7 +622,7 @@ tmbstr tidyNormalizedLocaleName( ctmbstr locale ) len = strlen( search ); len = len <= 5 ? len : 5; - for ( i = 0; i < len; i++ ) + for ( i = 0; i <= len; i++ ) { if ( i == 2 ) {