Merge branch 'master' into lang_help_enhance

This commit is contained in:
Jim Derry 2016-03-24 10:37:37 +08:00
commit d0ec84c169

View file

@ -363,6 +363,7 @@ module PoConvertModule
self.items[l_key] = {} unless items.has_key?(l_key) self.items[l_key] = {} unless items.has_key?(l_key)
self.items[l_key][num_case] = {} self.items[l_key][num_case] = {}
self.items[l_key][num_case][:comment] = comment 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][:case] = num_case
self.items[l_key][num_case][:if_group] = nil self.items[l_key][num_case][:if_group] = nil
# Reconstitute Hex Escapes # Reconstitute Hex Escapes
@ -537,7 +538,7 @@ module PoConvertModule
if result if result
@@log.info "#{__method__}: The header template was found at #{@@header_template}" @@log.info "#{__method__}: The header template was found at #{@@header_template}"
else else
@@log.error "#{__method__}: Cannot find the header teamplate file. Check the value of @@header_template in this script." @@log.error "#{__method__}: Cannot find the header template file. Check the value of @@header_template in this script."
return false return false
end end
@ -657,7 +658,7 @@ msgstr ""
"#{header_pot_line}\\n" "#{header_pot_line}\\n"
"Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\n" "Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\n"
"Language-Team: \\n" "Language-Team: \\n"
"BAD"
HEREDOC HEREDOC
untranslated_items.delete(:TIDY_LANGUAGE) untranslated_items.delete(:TIDY_LANGUAGE)
@ -667,9 +668,13 @@ msgstr ""
if value['0'][:comment] if value['0'][:comment]
value['0'][:comment].each_line { |line| report << "#. #{line.strip}\n"} value['0'][:comment].each_line { |line| report << "#. #{line.strip}\n"}
end end
if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) } attribs = []
report << "#, c-format\n" attribs << 'fuzzy' if value['0'][:fuzzy]
attribs << 'c-format' if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) }
if attribs.count > 0
report << "#, #{attribs.join(', ')}\n"
end end
report << "msgctxt \"#{key.to_s}\"\n" report << "msgctxt \"#{key.to_s}\"\n"
# Handle the untranslated strings, with the possibility that there # Handle the untranslated strings, with the possibility that there