gettext 1.0.0-mswin32 → 1.1.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +193 -0
- data/NEWS +51 -1
- data/README +29 -11
- data/Rakefile +70 -56
- data/bin/rgettext +2 -0
- data/bin/rmsgfmt +2 -0
- data/bin/rmsgmerge +24 -0
- data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/ext/gettext/gettext/_locale.BAK +86 -0
- data/ext/gettext/gettext/_locale.c +1 -1
- data/ext/gettext/gettext/_locale.exp +0 -0
- data/ext/gettext/gettext/_locale.lib +0 -0
- data/ext/gettext/gettext/_locale.obj +0 -0
- data/ext/gettext/gettext/_locale.pdb +0 -0
- data/ext/gettext/gettext/_locale.so +0 -0
- data/ext/gettext/gettext/mkmf.log +4 -4
- data/ext/gettext/gettext/vc70.pdb +0 -0
- data/lib/_locale.so +0 -0
- data/lib/gettext.rb +17 -4
- data/lib/gettext/cgi.rb +34 -19
- data/lib/gettext/locale.rb +3 -13
- data/lib/gettext/locale_default.rb +2 -2
- data/lib/gettext/locale_win32.rb +27 -7
- data/lib/gettext/mo.rb +6 -1
- data/lib/gettext/parser/activerecord.rb +115 -0
- data/lib/gettext/parser/glade.rb +3 -1
- data/lib/gettext/parser/ruby.rb +56 -57
- data/lib/gettext/poparser.rb +297 -0
- data/lib/gettext/rails.rb +161 -3
- data/lib/gettext/rgettext.rb +19 -9
- data/lib/gettext/rmsgfmt.rb +95 -363
- data/lib/gettext/rmsgmerge.rb +381 -0
- data/lib/gettext/string.rb +26 -0
- data/lib/gettext/textdomain.rb +21 -18
- data/lib/gettext/utils.rb +55 -0
- data/lib/gettext/version.rb +1 -1
- data/po/cs/rails.po +83 -0
- data/po/cs/rgettext.po +104 -0
- data/po/de/rails.po +79 -0
- data/po/de/rgettext.po +72 -21
- data/po/es/rails.po +80 -0
- data/po/es/rgettext.po +75 -19
- data/po/fr/rails.po +81 -0
- data/po/fr/rgettext.po +75 -19
- data/po/it/rgettext.po +68 -17
- data/po/ja/rails.po +78 -0
- data/po/ja/rgettext.po +71 -20
- data/po/ko/rails.po +77 -0
- data/po/ko/rgettext.po +74 -22
- data/po/nl/rails.po +80 -0
- data/po/nl/rgettext.po +102 -0
- data/po/pt_BR/rails.po +79 -0
- data/po/pt_BR/rgettext.po +77 -24
- data/po/rails.pot +80 -0
- data/po/rgettext.pot +63 -13
- data/po/sv/rgettext.po +63 -15
- data/samples/cgi/cookie.cgi +5 -0
- data/samples/cgi/helloerb1.cgi +4 -0
- data/samples/cgi/helloerb2.cgi +5 -0
- data/samples/cgi/index.cgi +5 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/fr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/cs/helloerb1.po +66 -0
- data/samples/cgi/po/cs/helloerb2.po +52 -0
- data/samples/cgi/po/cs/hellolib.po +25 -0
- data/samples/cgi/po/cs/main.po +78 -0
- data/samples/cgi/po/fr/main.po +8 -8
- data/samples/cgi/po/ko/helloerb1.po +2 -3
- data/samples/cgi/po/ko/helloerb2.po +1 -2
- data/samples/cgi/po/ko/hellolib.po +1 -2
- data/samples/cgi/po/ko/main.po +2 -3
- data/samples/cgi/po/nl/helloerb1.po +60 -0
- data/samples/cgi/po/nl/helloerb2.po +52 -0
- data/samples/cgi/po/nl/hellolib.po +24 -0
- data/samples/cgi/po/nl/main.po +76 -0
- data/samples/cgi/po/pt_BR/helloerb1.po +59 -0
- data/samples/cgi/po/pt_BR/helloerb2.po +51 -0
- data/samples/cgi/po/pt_BR/hellolib.po +22 -0
- data/samples/cgi/po/pt_BR/main.po +75 -0
- data/samples/locale/cs/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/fr/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/po/cs/hello.po +23 -0
- data/samples/po/cs/hello2.po +31 -0
- data/samples/po/cs/hello_noop.po +27 -0
- data/samples/po/cs/hello_plural.po +26 -0
- data/samples/po/cs/helloglade2.po +37 -0
- data/samples/po/cs/hellogtk.po +23 -0
- data/samples/po/cs/hellotk.po +23 -0
- data/samples/po/fr/helloglade2.po +2 -2
- data/samples/po/hello.pot +1 -0
- data/samples/po/hello2.pot +1 -0
- data/samples/po/hello_noop.pot +2 -1
- data/samples/po/hello_plural.pot +6 -2
- data/samples/po/helloglade2.pot +8 -3
- data/samples/po/hellotk.pot +4 -0
- data/samples/po/ko/hello.po +1 -2
- data/samples/po/ko/hello2.po +1 -2
- data/samples/po/ko/hello_noop.po +1 -2
- data/samples/po/ko/hello_plural.po +1 -2
- data/samples/po/ko/helloglade2.po +2 -2
- data/samples/po/ko/hellogtk.po +1 -2
- data/samples/po/ko/hellotk.po +1 -2
- data/samples/po/nl/hello.po +24 -0
- data/samples/po/nl/hello2.po +32 -0
- data/samples/po/nl/hello_noop.po +28 -0
- data/samples/po/nl/hello_plural.po +26 -0
- data/samples/po/nl/helloglade2.po +31 -0
- data/samples/po/nl/hellogtk.po +24 -0
- data/samples/po/nl/hellotk.po +24 -0
- data/samples/po/pt_BR/hello.po +6 -5
- data/samples/po/pt_BR/hello2.po +6 -5
- data/samples/po/pt_BR/hello_noop.po +6 -5
- data/samples/po/pt_BR/hello_plural.po +6 -6
- data/samples/po/pt_BR/helloglade2.po +6 -5
- data/samples/po/pt_BR/hellogtk.po +6 -5
- data/samples/po/pt_BR/hellotk.po +6 -5
- data/samples/rails/README +21 -15
- data/samples/rails/Rakefile +10 -1
- data/samples/rails/app/controllers/application.rb +10 -18
- data/samples/rails/app/controllers/blog_controller.rb +1 -5
- data/samples/rails/app/helpers/blog_helper.rb +1 -1
- data/samples/rails/app/models/article.rb +15 -0
- data/samples/rails/app/views/blog/_form.rhtml +2 -2
- data/samples/rails/config/boot.rb +17 -0
- data/samples/rails/config/database.yml +6 -4
- data/samples/rails/config/environment.rb +40 -75
- data/samples/rails/config/environments/development.rb +12 -7
- data/samples/rails/config/environments/production.rb +17 -6
- data/samples/rails/config/environments/test.rb +8 -6
- data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/{lang_helper.mo → gettext_plugin.mo} +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/{lang_helper.mo → gettext_plugin.mo} +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/po/blog.pot +57 -37
- data/samples/rails/po/cs/blog.po +116 -0
- data/samples/rails/po/cs/gettext_plugin.po +29 -0
- data/samples/rails/po/de/blog.po +70 -51
- data/samples/rails/po/de/{lang_helper.po → gettext_plugin.po} +4 -5
- data/samples/rails/po/en/blog.po +111 -0
- data/samples/rails/po/es/blog.po +67 -47
- data/samples/rails/po/es/{lang_helper.po → gettext_plugin.po} +5 -5
- data/samples/rails/po/fr/blog.po +65 -45
- data/samples/rails/po/fr/{lang_helper.po → gettext_plugin.po} +4 -4
- data/samples/rails/po/{lang_helper.pot → gettext_plugin.pot} +4 -4
- data/samples/rails/po/ja/blog.po +64 -44
- data/samples/rails/po/ja/{lang_helper.po → gettext_plugin.po} +4 -4
- data/samples/rails/po/ko/blog.po +65 -46
- data/samples/rails/po/ko/{lang_helper.po → gettext_plugin.po} +5 -6
- data/samples/rails/po/nl/blog.po +115 -0
- data/samples/rails/po/nl/gettext_plugin.po +28 -0
- data/samples/rails/po/pt_BR/blog.po +109 -0
- data/samples/rails/po/pt_BR/gettext_plugin.po +27 -0
- data/samples/rails/public/images/rails.png +0 -0
- data/samples/rails/public/index.html +272 -71
- data/samples/rails/public/javascripts/controls.js +441 -166
- data/samples/rails/public/javascripts/dragdrop.js +261 -279
- data/samples/rails/public/javascripts/effects.js +657 -277
- data/samples/rails/public/javascripts/prototype.js +911 -223
- data/samples/rails/public/robots.txt +1 -0
- data/samples/rails/public/stylesheets/scaffold.css +1 -1
- data/samples/rails/script/about +3 -0
- data/samples/rails/script/breakpointer +3 -4
- data/samples/rails/script/console +3 -23
- data/samples/rails/script/destroy +3 -7
- data/samples/rails/script/generate +3 -7
- data/samples/rails/script/performance/benchmarker +3 -0
- data/samples/rails/script/performance/profiler +3 -0
- data/samples/rails/script/plugin +3 -0
- data/samples/rails/script/process/reaper +3 -0
- data/samples/rails/script/process/spawner +3 -0
- data/samples/rails/script/process/spinner +3 -0
- data/samples/rails/script/runner +3 -29
- data/samples/rails/script/server +3 -49
- data/samples/rails/vendor/plugins/gettext/init.rb +19 -0
- data/samples/rails/vendor/{lang_helper.rb → plugins/gettext/lib/gettext_plugin.rb} +15 -11
- data/src/poparser.ry +171 -0
- data/test/gettext_runner.rb +3 -1
- data/test/gettext_test.rb +56 -31
- data/test/gettext_test_cgi.rb +12 -0
- data/test/gettext_test_parser.rb +3 -0
- data/test/gettext_test_string.rb +14 -0
- data/test/locale/cr/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/da/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/da/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/fr/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/ir/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/la/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/li/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/po/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/sl/LC_MESSAGES/plural.mo +0 -0
- data/test/po/cr/plural.po +3 -3
- data/test/po/da/plural.po +2 -2
- data/test/po/da/plural_error.po +2 -1
- data/test/po/fr/plural.po +2 -2
- data/test/po/fr/plural_error.po +2 -1
- data/test/po/ir/plural.po +3 -3
- data/test/po/la/plural.po +3 -3
- data/test/po/li/plural.po +3 -3
- data/test/po/po/plural.po +3 -3
- data/test/po/sl/plural.po +4 -4
- data/test/test.sh +1 -0
- data/test/test_rubyparser.rb +20 -0
- data/test/{test_rubyparser_n.rb → test_rubyparser_N.rb} +0 -0
- metadata +163 -43
- data/README.ja +0 -115
- data/data/locale/de/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/gettext-1.0.0-mswin32.gem +0 -0
- data/po/de/rmsgfmt.po +0 -45
- data/po/es/rmsgfmt.po +0 -43
- data/po/fr/rmsgfmt.po +0 -43
- data/po/it/rmsgfmt.po +0 -44
- data/po/ja/rmsgfmt.po +0 -43
- data/po/ko/rmsgfmt.po +0 -40
- data/po/pt_BR/rmsgfmt.po +0 -42
- data/po/rmsgfmt.pot +0 -40
- data/po/sv/rmsgfmt.po +0 -43
- data/samples/rails/locale/de/LC_MESSAGES/lang_helper.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/lang_helper.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/lang_helper.mo +0 -0
- data/samples/rails/log/development.log +0 -378
- data/src/rmsgfmt.ry +0 -233
data/lib/gettext/mo.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
of Ruby. License of Ruby is included with Ruby distribution in
|
13
13
|
the file "README".
|
14
14
|
|
15
|
-
$Id: mo.rb,v 1.
|
15
|
+
$Id: mo.rb,v 1.2 2005/10/22 10:49:59 mutoh Exp $
|
16
16
|
=end
|
17
17
|
|
18
18
|
require 'gettext/iconv'
|
@@ -233,6 +233,11 @@ class MOFile < Hash
|
|
233
233
|
File.open(filename, 'wb'){|f| save_to_stream(f)}
|
234
234
|
end
|
235
235
|
|
236
|
+
def set_comment(msgid_or_sym, comment)
|
237
|
+
#Do nothing
|
238
|
+
end
|
239
|
+
|
240
|
+
|
236
241
|
attr_accessor :little_endian
|
237
242
|
attr_reader :charset, :nplurals, :plural
|
238
243
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
=begin
|
3
|
+
parser/activerecord.rb - parser for ActiveRecord
|
4
|
+
|
5
|
+
Copyright (C) 2005 Masao Mutoh
|
6
|
+
|
7
|
+
You may redistribute it and/or modify it under the same
|
8
|
+
license terms as Ruby.
|
9
|
+
|
10
|
+
$Id: activerecord.rb,v 1.2 2005/12/25 11:43:20 mutoh Exp $
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'gettext'
|
14
|
+
require 'gettext/parser/ruby'
|
15
|
+
|
16
|
+
module GetText
|
17
|
+
module ActiveRecordParser
|
18
|
+
extend GetText
|
19
|
+
include GetText
|
20
|
+
GetText.bindtextdomain("rgettext")
|
21
|
+
|
22
|
+
@config = {
|
23
|
+
:db_yml => "config/database.yml",
|
24
|
+
:db_mode => "development",
|
25
|
+
:activerecord_classes => ["ActiveRecord::Base"],
|
26
|
+
:use_classname => true,
|
27
|
+
}
|
28
|
+
|
29
|
+
@ar_re = nil
|
30
|
+
|
31
|
+
module_function
|
32
|
+
def require_rails(file)
|
33
|
+
begin
|
34
|
+
require file
|
35
|
+
rescue MissingSourceFile
|
36
|
+
$stderr.puts _("'%{file}' is not found.") % {:file => file}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def init(config)
|
41
|
+
if config
|
42
|
+
config.each{|k, v|
|
43
|
+
@config[k] = v
|
44
|
+
}
|
45
|
+
end
|
46
|
+
@ar_re = /class.*(#{@config[:activerecord_classes].join("|")})/
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse(file, targets = [])
|
50
|
+
ActiveRecord::Base.establish_connection(@db)
|
51
|
+
|
52
|
+
old_constants = constants
|
53
|
+
begin
|
54
|
+
eval(open(file).read)
|
55
|
+
rescue
|
56
|
+
$stderr.puts _("Ignored '%{file}'. Solve dependencies first.") % {:file => file}
|
57
|
+
$stderr.puts $!
|
58
|
+
end
|
59
|
+
loaded_constants = constants - old_constants
|
60
|
+
loaded_constants.each do |classname|
|
61
|
+
klass = eval(classname)
|
62
|
+
if klass < ActiveRecord::Base
|
63
|
+
tablename = klass.human_attribute_name(klass.class_name)
|
64
|
+
targets << [tablename, "#{file}:-"]
|
65
|
+
begin
|
66
|
+
klass.columns.each do |column|
|
67
|
+
if @config[:use_classname]
|
68
|
+
targets << [tablename + "|" + klass.human_attribute_name(column.name), "#{file}:-"]
|
69
|
+
else
|
70
|
+
targets << [klass.human_attribute_name(column.name), "#{file}:-"]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
rescue
|
74
|
+
$stderr.puts _("No database is available.")
|
75
|
+
$stderr.puts $!
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if RubyParser.target?(file)
|
80
|
+
RubyParser.parse(file, targets)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def target?(file)
|
85
|
+
init(nil) unless @ar_re
|
86
|
+
data = IO.readlines(file)
|
87
|
+
data.each do |v|
|
88
|
+
if @ar_re =~ v
|
89
|
+
unless @db
|
90
|
+
require 'rubygems'
|
91
|
+
require 'active_record'
|
92
|
+
yml = YAML.load_file(@config[:db_yml])
|
93
|
+
@db = yml[:db_mode]
|
94
|
+
@db = yml["production"] unless @db
|
95
|
+
require_rails 'config/boot.rb'
|
96
|
+
require_rails 'config/environment.rb'
|
97
|
+
require_rails 'app/controllers/application.rb'
|
98
|
+
end
|
99
|
+
return true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if __FILE__ == $0
|
108
|
+
# ex) ruby model1.rb model2.rb
|
109
|
+
ARGV.each do |file|
|
110
|
+
if GetText::ActiveRecordParser.target?(file)
|
111
|
+
p file
|
112
|
+
p GetText::ActiveRecordParser.parse(file)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
data/lib/gettext/parser/glade.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
7
7
|
license terms as Ruby.
|
8
8
|
|
9
|
-
$Id: glade.rb,v 1.
|
9
|
+
$Id: glade.rb,v 1.2 2005/12/17 07:12:40 mutoh Exp $
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'cgi'
|
@@ -14,6 +14,8 @@ require 'gettext'
|
|
14
14
|
|
15
15
|
module GetText
|
16
16
|
module GladeParser
|
17
|
+
extend GetText
|
18
|
+
bindtextdomain("rgettext")
|
17
19
|
|
18
20
|
TARGET1 = /<property.*translatable="yes">(.*)/
|
19
21
|
TARGET2 = /(.*)<\/property>/
|
data/lib/gettext/parser/ruby.rb
CHANGED
@@ -3,43 +3,27 @@
|
|
3
3
|
parser/ruby.rb - parser for ruby script
|
4
4
|
|
5
5
|
Copyright (C) 2003-2005 Masao Mutoh
|
6
|
+
Copyright (C) 2005 speakillof
|
6
7
|
Copyright (C) 2001,2002 Yasushi Shoji, Masao Mutoh
|
7
8
|
|
8
|
-
Yasushi Shoji <yashi@yashi.com>
|
9
|
-
Masao Mutoh <mutoh@highway.ne.jp>
|
10
|
-
|
11
9
|
You may redistribute it and/or modify it under the same
|
12
10
|
license terms as Ruby.
|
13
11
|
|
14
|
-
$Id: ruby.rb,v 1.
|
12
|
+
$Id: ruby.rb,v 1.4 2005/12/17 07:12:40 mutoh Exp $
|
15
13
|
=end
|
16
14
|
|
17
|
-
require 'irb/ruby-lex'
|
18
|
-
require 'irb/ruby-token'
|
15
|
+
require 'irb/ruby-lex.rb'
|
19
16
|
require 'stringio'
|
20
17
|
|
21
18
|
class RubyLexX < RubyLex
|
19
|
+
|
22
20
|
def initialize
|
23
21
|
super
|
24
22
|
@prompt = nil
|
25
23
|
@here_header = nil
|
26
24
|
@lex_state = nil
|
27
25
|
end
|
28
|
-
|
29
|
-
def token
|
30
|
-
tk = super
|
31
|
-
if $DEBUG
|
32
|
-
if tk.is_a? TkSTRING
|
33
|
-
$stderr.puts("#{tk}: #{tk.value}")
|
34
|
-
elsif tk.is_a? TkIDENTIFIER
|
35
|
-
$stderr.puts("#{tk}: #{tk.name}")
|
36
|
-
else
|
37
|
-
$stderr.puts(tk)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
tk
|
41
|
-
end
|
42
|
-
|
26
|
+
|
43
27
|
def read_escape
|
44
28
|
case ch = getc
|
45
29
|
when "\n", "\r", "\f"
|
@@ -92,44 +76,50 @@ class RubyLexX < RubyLex
|
|
92
76
|
end
|
93
77
|
end
|
94
78
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
79
|
+
# Parser#parse resemlbes RubyLex#lex
|
80
|
+
def parse
|
81
|
+
until ( (tk = token).kind_of?(RubyToken::TkEND_OF_SCRIPT) && !@continue or tk.nil? )
|
82
|
+
s = get_readed
|
83
|
+
|
84
|
+
if RubyToken::TkSTRING === tk
|
85
|
+
def tk.value
|
86
|
+
@value
|
87
|
+
end
|
88
|
+
|
89
|
+
def tk.value=(s)
|
90
|
+
@value = s
|
91
|
+
end
|
92
|
+
|
93
|
+
if @here_header
|
94
|
+
s = s.sub(/\A.*?\n/, '').sub(/^.*\n\Z/, '')
|
109
95
|
else
|
110
|
-
|
96
|
+
begin
|
97
|
+
s = eval(s)
|
98
|
+
rescue Exception
|
99
|
+
# Do nothing.
|
100
|
+
end
|
111
101
|
end
|
102
|
+
|
103
|
+
tk.value = s
|
112
104
|
end
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
105
|
+
|
106
|
+
if $DEBUG
|
107
|
+
if tk.is_a? TkSTRING
|
108
|
+
$stderr.puts("#{tk}: #{tk.value}")
|
109
|
+
elsif tk.is_a? TkIDENTIFIER
|
110
|
+
$stderr.puts("#{tk}: #{tk.name}")
|
111
|
+
else
|
112
|
+
$stderr.puts(tk)
|
113
|
+
end
|
122
114
|
end
|
123
|
-
|
124
|
-
|
125
|
-
@quoted = nil
|
126
|
-
@lex_state = EXPR_END
|
115
|
+
|
116
|
+
yield tk
|
127
117
|
end
|
118
|
+
|
119
|
+
return nil
|
128
120
|
end
|
129
|
-
end
|
130
121
|
|
131
|
-
|
132
|
-
# GetText::RubyParser
|
122
|
+
end
|
133
123
|
|
134
124
|
module GetText
|
135
125
|
module RubyParser
|
@@ -147,12 +137,13 @@ module GetText
|
|
147
137
|
rl = RubyLexX.new
|
148
138
|
rl.set_input(file)
|
149
139
|
rl.skip_space = true
|
150
|
-
rl.readed_auto_clean_up = true
|
140
|
+
#rl.readed_auto_clean_up = true
|
151
141
|
|
152
142
|
target = nil
|
153
143
|
msgid = nil
|
154
144
|
line_no = nil
|
155
|
-
|
145
|
+
|
146
|
+
rl.parse do |tk|
|
156
147
|
case tk
|
157
148
|
when RubyToken::TkIDENTIFIER, RubyToken::TkCONSTANT
|
158
149
|
if ID.include?(tk.name)
|
@@ -193,6 +184,7 @@ module GetText
|
|
193
184
|
end
|
194
185
|
targets
|
195
186
|
end
|
187
|
+
|
196
188
|
targets
|
197
189
|
end
|
198
190
|
|
@@ -201,11 +193,18 @@ module GetText
|
|
201
193
|
end
|
202
194
|
|
203
195
|
end
|
204
|
-
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
205
199
|
|
206
200
|
if __FILE__ == $0
|
207
|
-
|
201
|
+
require 'pp'
|
208
202
|
ARGV.each do |file|
|
209
|
-
|
203
|
+
pp GetText::RubyParser.parse(file)
|
210
204
|
end
|
205
|
+
|
206
|
+
#rl = RubyLexX.new; rl.set_input(ARGF)
|
207
|
+
#rl.parse do |tk|
|
208
|
+
#p tk
|
209
|
+
#end
|
211
210
|
end
|
@@ -0,0 +1,297 @@
|
|
1
|
+
=begin
|
2
|
+
poparser.rb - Generate a .mo
|
3
|
+
|
4
|
+
Copyright (C) 2003-2005 Masao Mutoh <mutoh@highway.ne.jp>
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
=end
|
9
|
+
|
10
|
+
#
|
11
|
+
# DO NOT MODIFY!!!!
|
12
|
+
# This file is automatically generated by racc 1.4.4
|
13
|
+
# from racc grammer file "src/poparser.ry".
|
14
|
+
#
|
15
|
+
|
16
|
+
require 'racc/parser'
|
17
|
+
|
18
|
+
|
19
|
+
module GetText
|
20
|
+
|
21
|
+
class PoParser < Racc::Parser
|
22
|
+
|
23
|
+
module_eval <<'..end src/poparser.ry modeval..id9163dcbd5f', 'src/poparser.ry', 90
|
24
|
+
include GetText
|
25
|
+
GetText.bindtextdomain("rgettext")
|
26
|
+
|
27
|
+
def unescape(orig)
|
28
|
+
ret = orig.gsub(/\\n/, "\n")
|
29
|
+
ret.gsub!(/\\t/, "\t")
|
30
|
+
ret.gsub!(/\\r/, "\r")
|
31
|
+
ret.gsub!(/\\"/, "\"")
|
32
|
+
ret
|
33
|
+
end
|
34
|
+
|
35
|
+
def parse(str, data)
|
36
|
+
@comments = []
|
37
|
+
@data = data
|
38
|
+
@fuzzy = false
|
39
|
+
str.strip!
|
40
|
+
@q = []
|
41
|
+
until str.empty? do
|
42
|
+
case str
|
43
|
+
when /\A\s+/
|
44
|
+
str = $'
|
45
|
+
when /\Amsgid_plural/
|
46
|
+
@q.push [:MSGID_PLURAL, $&]
|
47
|
+
str = $'
|
48
|
+
when /\Amsgid/
|
49
|
+
@q.push [:MSGID, $&]
|
50
|
+
str = $'
|
51
|
+
when /\Amsgstr/
|
52
|
+
@q.push [:MSGSTR, $&]
|
53
|
+
str = $'
|
54
|
+
when /\A\[(\d+)\]/
|
55
|
+
@q.push [:PLURAL_NUM, $1]
|
56
|
+
str = $'
|
57
|
+
when /\A\#~(.*)/
|
58
|
+
$stderr.print _("Warning: obsolete msgid is existed.\n")
|
59
|
+
$stderr.print " #{$&}\n"
|
60
|
+
@q.push [:COMMENT, $&]
|
61
|
+
str = $'
|
62
|
+
when /\A\#(.*)/
|
63
|
+
@q.push [:COMMENT, $&]
|
64
|
+
str = $'
|
65
|
+
when /\A\"(.*)\"/
|
66
|
+
@q.push [:STRING, $1]
|
67
|
+
str = $'
|
68
|
+
else
|
69
|
+
#c = str[0,1]
|
70
|
+
#@q.push [:STRING, c]
|
71
|
+
str = str[1..-1]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
@q.push [false, '$end']
|
75
|
+
if $DEBUG
|
76
|
+
@q.each do |a,b|
|
77
|
+
puts "[#{a}, #{b}]"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
@yydebug = true if $DEBUG
|
81
|
+
do_parse
|
82
|
+
|
83
|
+
if @comments.size > 0
|
84
|
+
@data.set_comment(:last, @comments.join("\n"))
|
85
|
+
end
|
86
|
+
@data
|
87
|
+
end
|
88
|
+
|
89
|
+
def next_token
|
90
|
+
@q.shift
|
91
|
+
end
|
92
|
+
|
93
|
+
def on_message(msgid, msgstr)
|
94
|
+
@data[msgid] = msgstr
|
95
|
+
|
96
|
+
@data.set_comment(msgid, @comments.join("\n"))
|
97
|
+
@comments.clear
|
98
|
+
end
|
99
|
+
|
100
|
+
def on_comment(comment)
|
101
|
+
@fuzzy = true if (/fuzzy/ =~ comment)
|
102
|
+
@comments << comment
|
103
|
+
end
|
104
|
+
|
105
|
+
..end src/poparser.ry modeval..id9163dcbd5f
|
106
|
+
|
107
|
+
##### racc 1.4.4 generates ###
|
108
|
+
|
109
|
+
racc_reduce_table = [
|
110
|
+
0, 0, :racc_error,
|
111
|
+
0, 9, :_reduce_none,
|
112
|
+
2, 9, :_reduce_none,
|
113
|
+
2, 9, :_reduce_none,
|
114
|
+
4, 11, :_reduce_4,
|
115
|
+
5, 11, :_reduce_5,
|
116
|
+
2, 13, :_reduce_6,
|
117
|
+
1, 13, :_reduce_none,
|
118
|
+
3, 14, :_reduce_8,
|
119
|
+
1, 10, :_reduce_9,
|
120
|
+
2, 12, :_reduce_10,
|
121
|
+
1, 12, :_reduce_11 ]
|
122
|
+
|
123
|
+
racc_reduce_n = 12
|
124
|
+
|
125
|
+
racc_shift_n = 21
|
126
|
+
|
127
|
+
racc_action_table = [
|
128
|
+
3, 9, 4, 5, 10, 11, 12, 17, 12, 9,
|
129
|
+
9, 7, 12, 17, 19, 9, 12 ]
|
130
|
+
|
131
|
+
racc_action_check = [
|
132
|
+
1, 5, 1, 1, 8, 8, 8, 13, 13, 10,
|
133
|
+
11, 3, 14, 15, 17, 19, 20 ]
|
134
|
+
|
135
|
+
racc_action_pointer = [
|
136
|
+
nil, 0, nil, 11, nil, -5, nil, nil, 0, nil,
|
137
|
+
3, 4, nil, 2, 6, 8, nil, 7, nil, 9,
|
138
|
+
10 ]
|
139
|
+
|
140
|
+
racc_action_default = [
|
141
|
+
-1, -12, -3, -12, -9, -12, -2, 21, -12, -11,
|
142
|
+
-12, -12, -10, -12, -4, -5, -7, -12, -6, -12,
|
143
|
+
-8 ]
|
144
|
+
|
145
|
+
racc_goto_table = [
|
146
|
+
8, 16, 2, 18, 6, 13, 14, 15, 1, nil,
|
147
|
+
nil, nil, nil, nil, 20 ]
|
148
|
+
|
149
|
+
racc_goto_check = [
|
150
|
+
4, 6, 3, 6, 2, 4, 4, 5, 1, nil,
|
151
|
+
nil, nil, nil, nil, 4 ]
|
152
|
+
|
153
|
+
racc_goto_pointer = [
|
154
|
+
nil, 8, 3, 1, -5, -6, -12 ]
|
155
|
+
|
156
|
+
racc_goto_default = [
|
157
|
+
nil, nil, nil, nil, nil, nil, nil ]
|
158
|
+
|
159
|
+
racc_token_table = {
|
160
|
+
false => 0,
|
161
|
+
Object.new => 1,
|
162
|
+
:COMMENT => 2,
|
163
|
+
:MSGID => 3,
|
164
|
+
:MSGID_PLURAL => 4,
|
165
|
+
:MSGSTR => 5,
|
166
|
+
:STRING => 6,
|
167
|
+
:PLURAL_NUM => 7 }
|
168
|
+
|
169
|
+
racc_use_result_var = true
|
170
|
+
|
171
|
+
racc_nt_base = 8
|
172
|
+
|
173
|
+
Racc_arg = [
|
174
|
+
racc_action_table,
|
175
|
+
racc_action_check,
|
176
|
+
racc_action_default,
|
177
|
+
racc_action_pointer,
|
178
|
+
racc_goto_table,
|
179
|
+
racc_goto_check,
|
180
|
+
racc_goto_default,
|
181
|
+
racc_goto_pointer,
|
182
|
+
racc_nt_base,
|
183
|
+
racc_reduce_table,
|
184
|
+
racc_token_table,
|
185
|
+
racc_shift_n,
|
186
|
+
racc_reduce_n,
|
187
|
+
racc_use_result_var ]
|
188
|
+
|
189
|
+
Racc_token_to_s_table = [
|
190
|
+
'$end',
|
191
|
+
'error',
|
192
|
+
'COMMENT',
|
193
|
+
'MSGID',
|
194
|
+
'MSGID_PLURAL',
|
195
|
+
'MSGSTR',
|
196
|
+
'STRING',
|
197
|
+
'PLURAL_NUM',
|
198
|
+
'$start',
|
199
|
+
'msgfmt',
|
200
|
+
'comment',
|
201
|
+
'message',
|
202
|
+
'string_list',
|
203
|
+
'msgstr_plural',
|
204
|
+
'msgstr_plural_line']
|
205
|
+
|
206
|
+
Racc_debug_parser = true
|
207
|
+
|
208
|
+
##### racc system variables end #####
|
209
|
+
|
210
|
+
# reduce 0 omitted
|
211
|
+
|
212
|
+
# reduce 1 omitted
|
213
|
+
|
214
|
+
# reduce 2 omitted
|
215
|
+
|
216
|
+
# reduce 3 omitted
|
217
|
+
|
218
|
+
module_eval <<'.,.,', 'src/poparser.ry', 36
|
219
|
+
def _reduce_4( val, _values, result )
|
220
|
+
if @fuzzy
|
221
|
+
if val[1] != ""
|
222
|
+
$stderr.print _("Warning: fuzzy message was ignored.\n")
|
223
|
+
$stderr.print " msgid '#{val[1]}'\n"
|
224
|
+
else
|
225
|
+
on_message('', unescape(val[3]))
|
226
|
+
end
|
227
|
+
@fuzzy = false
|
228
|
+
else
|
229
|
+
on_message(unescape(val[1]), unescape(val[3]))
|
230
|
+
end
|
231
|
+
result = ""
|
232
|
+
result
|
233
|
+
end
|
234
|
+
.,.,
|
235
|
+
|
236
|
+
module_eval <<'.,.,', 'src/poparser.ry', 51
|
237
|
+
def _reduce_5( val, _values, result )
|
238
|
+
if @fuzzy
|
239
|
+
if val[1] != ""
|
240
|
+
$stderr.print _("Warning: fuzzy message was ignored.\n")
|
241
|
+
$stderr.print "msgid = '#{val[1]}\n"
|
242
|
+
else
|
243
|
+
on_message('', unescape(val[3]))
|
244
|
+
end
|
245
|
+
@fuzzy = false
|
246
|
+
else
|
247
|
+
on_message(unescape(val[1]) + "\000" + unescape(val[3]), unescape(val[4]))
|
248
|
+
end
|
249
|
+
result = ""
|
250
|
+
result
|
251
|
+
end
|
252
|
+
.,.,
|
253
|
+
|
254
|
+
module_eval <<'.,.,', 'src/poparser.ry', 58
|
255
|
+
def _reduce_6( val, _values, result )
|
256
|
+
result = val[0] + "\000" + val[1]
|
257
|
+
result
|
258
|
+
end
|
259
|
+
.,.,
|
260
|
+
|
261
|
+
# reduce 7 omitted
|
262
|
+
|
263
|
+
module_eval <<'.,.,', 'src/poparser.ry', 66
|
264
|
+
def _reduce_8( val, _values, result )
|
265
|
+
result = val[2]
|
266
|
+
result
|
267
|
+
end
|
268
|
+
.,.,
|
269
|
+
|
270
|
+
module_eval <<'.,.,', 'src/poparser.ry', 73
|
271
|
+
def _reduce_9( val, _values, result )
|
272
|
+
on_comment(val[0])
|
273
|
+
result
|
274
|
+
end
|
275
|
+
.,.,
|
276
|
+
|
277
|
+
module_eval <<'.,.,', 'src/poparser.ry', 81
|
278
|
+
def _reduce_10( val, _values, result )
|
279
|
+
result = val.delete_if{|item| item == ""}.join
|
280
|
+
result
|
281
|
+
end
|
282
|
+
.,.,
|
283
|
+
|
284
|
+
module_eval <<'.,.,', 'src/poparser.ry', 85
|
285
|
+
def _reduce_11( val, _values, result )
|
286
|
+
result = val[0]
|
287
|
+
result
|
288
|
+
end
|
289
|
+
.,.,
|
290
|
+
|
291
|
+
def _reduce_none( val, _values, result )
|
292
|
+
result
|
293
|
+
end
|
294
|
+
|
295
|
+
end # class PoParser
|
296
|
+
|
297
|
+
end # module GetText
|