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