From f22fc8b42660b45d867b62422d488424bde32d39 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 10 Apr 2016 15:22:19 +0200 Subject: [PATCH] update_translation.rb: normalize po file after copying it --- Rakefile | 4 +--- rake.d/helpers.rb | 1 + rake.d/po.rb | 2 +- tools/development/update_translations.rb | 18 ++++++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Rakefile b/Rakefile index e8097c409..ac8c22bfa 100755 --- a/Rakefile +++ b/Rakefile @@ -31,9 +31,7 @@ require_relative "rake.d/config" read_config -$verbose = ENV['V'].to_bool -$action_width = 12 - +$verbose = ENV['V'].to_bool $build_system_modules = {} $have_gtest = (c(:GTEST_TYPE) == "system") || (c(:GTEST_TYPE) == "internal") $gtest_apps = [] diff --git a/rake.d/helpers.rb b/rake.d/helpers.rb index 3624d27bf..88d9d439c 100644 --- a/rake.d/helpers.rb +++ b/rake.d/helpers.rb @@ -5,6 +5,7 @@ require "fileutils" $git_mutex = Mutex.new $message_mutex = Mutex.new +$action_width = 12 def puts(message) $message_mutex.synchronize { diff --git a/rake.d/po.rb b/rake.d/po.rb index 4d627250f..43c5f52b5 100644 --- a/rake.d/po.rb +++ b/rake.d/po.rb @@ -125,7 +125,7 @@ def write_po file_name, items end def normalize_po file - puts "NORMALIZE-PO #{file}" + puts_action "NORMALIZE-PO", file write_po file, read_po(file) end diff --git a/tools/development/update_translations.rb b/tools/development/update_translations.rb index 00eed8258..ced9b766b 100755 --- a/tools/development/update_translations.rb +++ b/tools/development/update_translations.rb @@ -3,11 +3,16 @@ require "fileutils" require "pathname" +require "rake" require "shellwords" require "tmpdir" -$po_dir = File.absolute_path(File.dirname(__FILE__) + "/../../po") -$man_po_dir = File.absolute_path(File.dirname(__FILE__) + "/../../doc/man/po4a/po") +$mtx_dir = File.absolute_path(File.dirname(__FILE__) + "/../..") +$po_dir = "#{$mtx_dir}/po" +$man_po_dir = "#{$mtx_dir}doc/man/po4a/po" + +require "#{$mtx_dir}/rake.d/helpers" +require "#{$mtx_dir}/rake.d/po" module AddPo def self.handle_po file_name @@ -32,6 +37,8 @@ module AddPo File.chmod 0644, target puts "#{file_name} → #{target}" + + normalize_po target end def self.unpack_p7z file_name @@ -124,9 +131,4 @@ module AddPo end end -begin - # Running under Rake? - Rake -rescue - ARGV.each { |file_name| AddPo::add File.absolute_path(file_name) } -end +ARGV.each { |file_name| AddPo::add File.absolute_path(file_name) }