From 894e79a4da5e037c1f301d4d9d95ded955e24bf3 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Wed, 25 Dec 2013 13:39:29 +0900 Subject: [PATCH] i18n: use .po for base file of .edit.po --- _tasks/i18n.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/_tasks/i18n.rb b/_tasks/i18n.rb index 1dc5214b..30fedb03 100644 --- a/_tasks/i18n.rb +++ b/_tasks/i18n.rb @@ -69,6 +69,7 @@ def define_edit_po_locale_update_task(locale) @files.each do |target_file| base_name = File.basename(target_file, ".*") po_dir_path = base_po_dir_path + File.dirname(target_file) + po_file_path = po_dir_path + "#{base_name}.po" edit_po_file_path = po_dir_path + "#{base_name}.edit.po" edit_po_file_paths << edit_po_file_path @@ -82,17 +83,20 @@ def define_edit_po_locale_update_task(locale) pot_file_path.open("w") do |pot_file| pot_file.puts(generator.generate) end - if edit_po_file_path.exist? - GetText::Tools::MsgMerge.run("--update", - "--sort-by-file", - "--no-wrap", - edit_po_file_path.to_s, - pot_file_path.to_s) - else - GetText::Tools::MsgInit.run("--input", pot_file_path.to_s, - "--output", edit_po_file_path.to_s, - "--locale", "ja") + unless edit_po_file_path.exist? + if po_file_path.exist? + cp(po_file_path.to_s, edit_po_file_path.to_s) + else + GetText::Tools::MsgInit.run("--input", pot_file_path.to_s, + "--output", edit_po_file_path.to_s, + "--locale", "ja") + end end + GetText::Tools::MsgMerge.run("--update", + "--sort-by-file", + "--no-wrap", + edit_po_file_path.to_s, + pot_file_path.to_s) if all_po_file_path.exist? GetText::Tools::MsgMerge.run("--output", edit_po_file_path.to_s, "--sort-by-file",