Debian Codegraph @

core/boot/shell/makepot.rb

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 # 全プラグインにpot作成
3
4 require 'boot/delayer'
5 require "miquire_plugin"
6
7 require 'gettext/tools/task'
8 require 'rake'
9
10 mo_root = File.join(CHIConfig::CACHE, "uitranslator", "locale")
11
12 Environment::PLUGIN_PATH.each do |path|
13 Miquire::Plugin.loadpath << path
14 end
15 Miquire::Plugin.loadpath << File.join(Environment::CONFROOT, 'plugin')
16
17 enable_plugins = ARGV[1,]
18 failed_plugins = []
19
20 Miquire::Plugin.each_spec do |spec|
21 if (enable_plugins.empty? or enable_plugins.include? spec[:slug].to_s) and
22 (defined?(spec[:depends][:plugin]) and spec[:depends][:plugin].include? "uitranslator")
23 po_root = File.join spec[:path], "po"
24 begin
25 GetText::Tools::Task.define do |task|
26 task.spec = Gem::Specification.new do |s|
27 s.name = spec[:slug].to_s
28 s.version = spec[:version].to_s
29 s.files = Dir.glob("#{spec[:path]}/**/*.rb")
30 end
31 task.locales = ["ja"]
32 task.po_base_directory = po_root
33 end
34 rescue Exception => e
35 failed_plugins << spec[:slug]
36 end
37 end
38 end
39 notice Rake::Task.tasks.join("\n")
40
41 # gettext:po:updateがいちいち翻訳者名とか聞いてきてうざいので潰す。
42 # 本来はgettextにパッチを送るとかするべきな気がする。
43 class GetText::Tools::MsgInit
44 def translator_full_name
45 ""
46 end
47
48 def translator_mail
49 ""
50 end
51 end
52
53 Rake::Task["gettext:pot:create"].invoke
54 Rake::Task["gettext:po:update"].invoke
55
56 puts "failed plugins: #{failed_plugins}" unless failed_plugins.empty?