mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
build system: add targets for pushing to Transifex
This commit is contained in:
parent
63b07980a7
commit
8af78d72fc
38
Rakefile
38
Rakefile
@ -533,32 +533,54 @@ EOT
|
||||
normalize_po po_file
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :transifex do
|
||||
transifex_pull_targets = {
|
||||
"man-pages" => [],
|
||||
"programs" => [],
|
||||
}
|
||||
|
||||
transifex_push_targets = {
|
||||
"man-pages" => [],
|
||||
"programs" => [],
|
||||
}
|
||||
|
||||
$all_po_files.each do |po_file|
|
||||
language = /\/([^\/]+)\.po$/.match(po_file)[1]
|
||||
resource = /doc\/man/.match(po_file) ? "man-pages" : "programs"
|
||||
target = "transifex-pull-#{resource}-#{language}"
|
||||
language = /\/([^\/]+)\.po$/.match(po_file)[1]
|
||||
resource = /doc\/man/.match(po_file) ? "man-pages" : "programs"
|
||||
pull_target = "pull-#{resource}-#{language}"
|
||||
push_target = "push-#{resource}-#{language}"
|
||||
|
||||
transifex_pull_targets[resource] << "translations:update:#{target}"
|
||||
transifex_pull_targets[resource] << "translations:transifex:#{pull_target}"
|
||||
transifex_push_targets[resource] << "translations:transifex:#{push_target}"
|
||||
|
||||
task target => :no_unstaged_changes do
|
||||
task pull_target => :no_unstaged_changes do
|
||||
transifex_pull_and_merge resource, language
|
||||
end
|
||||
|
||||
task push_target => :no_unstaged_changes do
|
||||
transifex_remove_fuzzy_and_push resource, language
|
||||
end
|
||||
end
|
||||
|
||||
desc "Fetch and merge program translations from Transifex"
|
||||
task "transifex-programs" => transifex_pull_targets["programs"]
|
||||
task "pull-programs" => transifex_pull_targets["programs"]
|
||||
|
||||
desc "Fetch and merge man page translations from Transifex"
|
||||
task "transifex-man-pages" => transifex_pull_targets["man-pages"]
|
||||
task "pull-man-pages" => transifex_pull_targets["man-pages"]
|
||||
|
||||
desc "Fetch and merge all translations from Transifex"
|
||||
task "transifex" => transifex_pull_targets.values.flatten
|
||||
task "pull" => transifex_pull_targets.values.flatten
|
||||
|
||||
desc "Push program translations to Transifex"
|
||||
task "push-programs" => transifex_push_targets["programs"]
|
||||
|
||||
desc "Push man page translations to Transifex"
|
||||
task "push-man-pages" => transifex_push_targets["man-pages"]
|
||||
|
||||
desc "Push all translations to Transifex"
|
||||
task "push" => transifex_push_targets.values.flatten
|
||||
end
|
||||
|
||||
[ :stats, :statistics ].each_with_index do |task_name, idx|
|
||||
|
17
rake.d/po.rb
17
rake.d/po.rb
@ -193,3 +193,20 @@ def transifex_pull_and_merge resource, language
|
||||
|
||||
write_po po_file, merged_items
|
||||
end
|
||||
|
||||
def transifex_remove_fuzzy_and_push resource, language
|
||||
po_file = resource == "programs" ? "po/#{language}.po" : "doc/man/po4a/po/#{language}.po"
|
||||
po_file_no_fuzzy = Tempfile.new("mkvtoolnix-rake-po-no-fuzzy")
|
||||
|
||||
runq_git po_file, "checkout HEAD -- #{po_file}"
|
||||
|
||||
runq "MSGATTRIB #{po_file}", "msgattrib --no-fuzzy --output=#{po_file_no_fuzzy.path} #{po_file}"
|
||||
|
||||
IO.write(po_file, IO.read(po_file_no_fuzzy))
|
||||
|
||||
normalize_po po_file
|
||||
|
||||
runq " TX_PUSH #{po_file}", "tx push -t -f --no-interactive -r mkvtoolnix.#{resource} -l #{language} > /dev/null"
|
||||
|
||||
runq_git po_file, "checkout HEAD -- #{po_file}"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user