gettext 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +122 -1
- data/NEWS +21 -0
- data/README +30 -22
- data/data/locale/bs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/bs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -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/el/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/eo/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/eo/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/et/LC_MESSAGES/rails.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/hr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/hr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rails.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/nb/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nb/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/ru/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
- data/lib/gettext.rb +119 -37
- data/lib/gettext/active_record.rb +51 -31
- data/lib/gettext/locale_win32.rb +2 -1
- data/lib/gettext/parser/active_record.rb +2 -2
- data/lib/gettext/parser/ruby.rb +2 -2
- data/lib/gettext/poparser.rb +19 -14
- data/lib/gettext/rails.rb +104 -50
- data/lib/gettext/rails_compat.rb +16 -0
- data/lib/gettext/rgettext.rb +37 -3
- data/lib/gettext/textdomain.rb +45 -6
- data/lib/gettext/utils.rb +7 -0
- data/lib/gettext/version.rb +1 -1
- data/po/bs/rails.po +148 -0
- data/po/bs/rgettext.po +131 -0
- data/po/ca/rails.po +45 -26
- data/po/ca/rgettext.po +21 -21
- data/po/cs/rails.po +46 -24
- data/po/cs/rgettext.po +21 -21
- data/po/de/rails.po +46 -27
- data/po/de/rgettext.po +21 -21
- data/po/el/rails.po +46 -25
- data/po/el/rgettext.po +22 -22
- data/po/eo/rails.po +49 -30
- data/po/eo/rgettext.po +21 -21
- data/po/es/rails.po +45 -24
- data/po/es/rgettext.po +21 -21
- data/po/et/rails.po +49 -30
- data/po/fr/rails.po +47 -28
- data/po/fr/rgettext.po +31 -29
- data/po/hr/rails.po +148 -0
- data/po/hr/rgettext.po +131 -0
- data/po/it/rails.po +42 -24
- data/po/it/rgettext.po +21 -21
- data/po/ja/rails.po +43 -25
- data/po/ja/rgettext.po +21 -21
- data/po/ko/rails.po +44 -24
- data/po/ko/rgettext.po +21 -21
- data/po/nb/rails.po +140 -0
- data/po/nb/rgettext.po +127 -0
- data/po/nl/rails.po +50 -30
- data/po/nl/rgettext.po +21 -21
- data/po/pt_BR/rails.po +48 -29
- data/po/pt_BR/rgettext.po +21 -21
- data/po/rails.pot +42 -24
- data/po/rgettext.pot +21 -21
- data/po/ru/rails.po +50 -31
- data/po/ru/rgettext.po +21 -21
- data/po/sv/rgettext.po +21 -21
- data/po/vi/rails.po +141 -0
- data/po/vi/rgettext.po +126 -0
- data/po/zh/rails.po +60 -43
- data/po/zh/rgettext.po +22 -22
- data/po/zh_TW/rails.po +61 -43
- data/po/zh_TW/rgettext.po +22 -22
- data/samples/cgi/locale/bs/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/helloerb2.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/nb/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/bs/helloerb1.po +59 -0
- data/samples/cgi/po/bs/helloerb2.po +51 -0
- data/samples/cgi/po/bs/hellolib.po +23 -0
- data/samples/cgi/po/bs/main.po +83 -0
- data/samples/cgi/po/hr/helloerb1.po +59 -0
- data/samples/cgi/po/hr/helloerb2.po +51 -0
- data/samples/cgi/po/hr/hellolib.po +23 -0
- data/samples/cgi/po/hr/main.po +83 -0
- data/samples/cgi/po/nb/helloerb1.po +58 -0
- data/samples/cgi/po/nb/helloerb2.po +50 -0
- data/samples/cgi/po/nb/hellolib.po +22 -0
- data/samples/cgi/po/nb/main.po +82 -0
- data/samples/cgi/po/vi/helloerb1.po +65 -0
- data/samples/cgi/po/vi/helloerb2.po +52 -0
- data/samples/cgi/po/vi/hellolib.po +24 -0
- data/samples/cgi/po/vi/main.po +77 -0
- data/samples/locale/bs/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/ja/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/po/bs/hello.po +23 -0
- data/samples/po/bs/hello2.po +31 -0
- data/samples/po/bs/hello_noop.po +27 -0
- data/samples/po/bs/hello_plural.po +26 -0
- data/samples/po/bs/helloglade2.po +31 -0
- data/samples/po/bs/hellogtk.po +23 -0
- data/samples/po/bs/hellotk.po +23 -0
- data/samples/po/hr/hello.po +23 -0
- data/samples/po/hr/hello2.po +31 -0
- data/samples/po/hr/hello_noop.po +27 -0
- data/samples/po/hr/hello_plural.po +26 -0
- data/samples/po/hr/helloglade2.po +31 -0
- data/samples/po/hr/hellogtk.po +23 -0
- data/samples/po/hr/hellotk.po +23 -0
- data/samples/po/ja/hello_plural.po +1 -1
- data/samples/po/nb/hello.po +22 -0
- data/samples/po/nb/hello2.po +31 -0
- data/samples/po/nb/hello_noop.po +26 -0
- data/samples/po/nb/hello_plural.po +24 -0
- data/samples/po/nb/helloglade2.po +30 -0
- data/samples/po/nb/hellogtk.po +22 -0
- data/samples/po/nb/hellotk.po +22 -0
- data/samples/po/vi/hello.po +23 -0
- data/samples/po/vi/hello2.po +31 -0
- data/samples/po/vi/hello_noop.po +27 -0
- data/samples/po/vi/hello_plural.po +26 -0
- data/samples/po/vi/helloglade2.po +38 -0
- data/samples/po/vi/hellogtk.po +23 -0
- data/samples/po/vi/hellotk.po +24 -0
- data/samples/rails/locale/bs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/hr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nb/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/vi/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/po/bs/blog.po +106 -0
- data/samples/rails/po/hr/blog.po +106 -0
- data/samples/rails/po/nb/blog.po +104 -0
- data/samples/rails/po/vi/blog.po +110 -0
- data/samples/rails/vendor/plugins/gettext/locale/bs/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/hr/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/nb/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/vi/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/po/bs/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/hr/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/nb/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/vi/gettext_plugin.po +28 -0
- data/src/poparser.ry +9 -4
- data/test/README +2 -0
- data/test/Rakefile +2 -0
- data/test/db/mysql.drop.sql +4 -0
- data/test/db/mysql.sql +44 -0
- data/test/gettext_test.rb +51 -13
- data/test/gettext_test_active_record.rb +33 -0
- data/test/gettext_test_parser.rb +5 -0
- data/test/gettext_test_rails_caching.rb +211 -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/ja/LC_MESSAGES/active_record.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/test_nsgettext.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/test_sgettext.mo +0 -0
- data/test/locale/la/LC_MESSAGES/plural_error.mo +0 -0
- data/test/po/da/plural_error.po +3 -3
- data/test/po/fr/plural.po +6 -0
- data/test/po/fr/plural_error.po +3 -3
- data/test/po/ja/plural.po +6 -0
- data/test/po/ja/plural_error.po +2 -2
- data/test/po/ja/test_nsgettext.po +65 -0
- data/test/po/la/plural_error.po +3 -3
- data/test/rails/README +5 -0
- data/test/rails/Rakefile +35 -0
- data/test/rails/app/controllers/application.rb +8 -0
- data/test/rails/app/controllers/articles_controller.rb +61 -0
- data/test/rails/app/controllers/mailer_controller.rb +19 -0
- data/test/rails/app/helpers/application_helper.rb +3 -0
- data/test/rails/app/helpers/articles_helper.rb +2 -0
- data/test/rails/app/helpers/mailer_helper.rb +2 -0
- data/test/rails/app/models/article.rb +5 -0
- data/test/rails/app/models/mailer.rb +38 -0
- data/test/rails/app/models/user.rb +3 -0
- data/test/rails/app/views/articles/_form.rhtml +13 -0
- data/test/rails/app/views/articles/edit.rhtml +9 -0
- data/test/rails/app/views/articles/list.rhtml +30 -0
- data/test/rails/app/views/articles/list_fr.rhtml +1 -0
- data/test/rails/app/views/articles/multi_error_messages_for.rhtml +19 -0
- data/test/rails/app/views/articles/new.rhtml +8 -0
- data/test/rails/app/views/articles/show.rhtml +28 -0
- data/test/rails/app/views/layouts/application.rhtml +14 -0
- data/test/rails/app/views/layouts/mailer.rhtml +20 -0
- data/test/rails/app/views/mailer/coverpage.rhtml +6 -0
- data/test/rails/app/views/mailer/coverpage_fr.rhtml +6 -0
- data/test/rails/app/views/mailer/singlepart.rhtml +3 -0
- data/test/rails/app/views/mailer/singlepart_fr.rhtml +3 -0
- data/test/rails/config/boot.rb +45 -0
- data/test/rails/config/database.yml +36 -0
- data/test/rails/config/environment.rb +64 -0
- data/test/rails/config/environments/development.rb +21 -0
- data/test/rails/config/environments/production.rb +18 -0
- data/test/rails/config/environments/test.rb +19 -0
- data/test/rails/config/routes.rb +23 -0
- data/test/rails/db/schema.rb +27 -0
- data/test/rails/log/development.log +29 -0
- data/test/rails/log/test.log +329 -0
- data/test/rails/po/ja/rails_test.po +142 -0
- data/test/rails/po/rails_test.pot +147 -0
- data/test/rails/public/404.html +30 -0
- data/test/rails/public/500.html +30 -0
- data/test/rails/public/dispatch.cgi +10 -0
- data/test/rails/public/dispatch.fcgi +24 -0
- data/test/rails/public/dispatch.rb +10 -0
- data/test/rails/public/favicon.ico +0 -0
- data/test/rails/public/images/rails.png +0 -0
- data/test/rails/public/index.html +277 -0
- data/test/rails/public/javascripts/application.js +2 -0
- data/test/rails/public/javascripts/controls.js +833 -0
- data/test/rails/public/javascripts/dragdrop.js +942 -0
- data/test/rails/public/javascripts/effects.js +1088 -0
- data/test/rails/public/javascripts/prototype.js +2515 -0
- data/test/rails/public/robots.txt +1 -0
- data/test/rails/public/stylesheets/scaffold.css +74 -0
- data/test/rails/script/about +3 -0
- data/test/rails/script/breakpointer +3 -0
- data/test/rails/script/console +3 -0
- data/test/rails/script/destroy +3 -0
- data/test/rails/script/generate +3 -0
- data/test/rails/script/performance/benchmarker +3 -0
- data/test/rails/script/performance/profiler +3 -0
- data/test/rails/script/plugin +3 -0
- data/test/rails/script/process/inspector +3 -0
- data/test/rails/script/process/reaper +3 -0
- data/test/rails/script/process/spawner +3 -0
- data/test/rails/script/runner +3 -0
- data/test/rails/script/server +3 -0
- data/test/rails/test/fixtures/articles.yml +11 -0
- data/test/rails/test/functional/articles_controller_test.rb +109 -0
- data/test/rails/test/functional/mailer_controller_test.rb +93 -0
- data/test/rails/test/integration/general_stories_test.rb +58 -0
- data/test/rails/test/result/en/create_error.html +95 -0
- data/test/rails/test/result/en/list.html +65 -0
- data/test/rails/test/result/en/multi_error_messages_for.html +153 -0
- data/test/rails/test/result/en/multipart.html +67 -0
- data/test/rails/test/result/en/new.html +95 -0
- data/test/rails/test/result/en/show.html +50 -0
- data/test/rails/test/result/en/singlepart.html +10 -0
- data/test/rails/test/result/fr/list.html +15 -0
- data/test/rails/test/result/fr/multipart.html +67 -0
- data/test/rails/test/result/fr/singlepart.html +10 -0
- data/test/rails/test/result/ja/create_error.html +95 -0
- data/test/rails/test/result/ja/list.html +65 -0
- data/test/rails/test/result/ja/multi_error_messages_for.html +153 -0
- data/test/rails/test/result/ja/multipart.html +67 -0
- data/test/rails/test/result/ja/new.html +95 -0
- data/test/rails/test/result/ja/show.html +50 -0
- data/test/rails/test/result/ja/singlepart.html +10 -0
- data/test/rails/test/test_helper.rb +28 -0
- data/test/rails/test/unit/article_test.rb +18 -0
- data/test/test.sh +4 -0
- data/test/test_nsgettext.rb +44 -0
- data/test/test_rubyparser_n_.rb +10 -0
- metadata +587 -288
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
|
7
7
|
license terms as Ruby.
|
|
8
8
|
|
|
9
|
-
$Id: active_record.rb,v 1.
|
|
9
|
+
$Id: active_record.rb,v 1.21 2007/07/04 15:51:30 mutoh Exp $
|
|
10
10
|
=end
|
|
11
11
|
require 'gettext'
|
|
12
12
|
require 'active_record'
|
|
13
|
+
require 'gettext/rails_compat'
|
|
13
14
|
|
|
14
15
|
module ActiveRecord #:nodoc:
|
|
15
16
|
class Migration
|
|
@@ -36,41 +37,61 @@ module ActiveRecord #:nodoc:
|
|
|
36
37
|
attr_accessor :table_class
|
|
37
38
|
alias :human_name_witout_localized :human_name
|
|
38
39
|
|
|
39
|
-
def
|
|
40
|
-
table_class
|
|
40
|
+
def human_name_with_gettext
|
|
41
|
+
if table_class
|
|
42
|
+
table_class.human_attribute_name(@name)
|
|
43
|
+
else
|
|
44
|
+
@name.humanize
|
|
45
|
+
end
|
|
41
46
|
end
|
|
47
|
+
alias_method_chain :human_name, :gettext
|
|
42
48
|
end
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
module Validations # :nodoc:
|
|
46
|
-
|
|
47
|
-
base
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
real_included(base)
|
|
52
|
+
class << self
|
|
53
|
+
def real_included(base)
|
|
54
|
+
base.extend ClassMethods
|
|
55
|
+
base.class_eval{
|
|
56
|
+
include GetText
|
|
57
|
+
def gettext(str) #:nodoc:
|
|
58
|
+
_(str)
|
|
59
|
+
end
|
|
60
|
+
class << self
|
|
61
|
+
def human_attribute_name_with_gettext(attribute_key_name) #:nodoc:
|
|
62
|
+
s_("#{self}|#{attribute_key_name.humanize}")
|
|
63
|
+
end
|
|
64
|
+
alias_method_chain :human_attribute_name, :gettext
|
|
65
|
+
def human_attribute_table_name_for_error(table_name) #:nodoc:
|
|
66
|
+
_(table_name.gsub(/_/, " "))
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
}
|
|
70
|
+
end
|
|
66
71
|
end
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
|
|
73
|
+
if respond_to? :included
|
|
74
|
+
class << self
|
|
75
|
+
def included_with_gettext(base) # :nodoc:
|
|
76
|
+
unless base <= ActiveRecord::Base
|
|
77
|
+
included_without_gettext(base)
|
|
78
|
+
end
|
|
79
|
+
real_included(base)
|
|
80
|
+
end
|
|
81
|
+
alias_method_chain :included, :gettext
|
|
82
|
+
end
|
|
83
|
+
else
|
|
84
|
+
class << self
|
|
85
|
+
# Since rails-1.2.0.
|
|
86
|
+
def append_features_with_gettext(base) # :nodoc:
|
|
87
|
+
unless base <= ActiveRecord::Base
|
|
88
|
+
append_features_without_gettext(base)
|
|
89
|
+
end
|
|
90
|
+
real_included(base)
|
|
91
|
+
end
|
|
92
|
+
alias_method_chain :append_features, :gettext
|
|
93
|
+
end
|
|
72
94
|
end
|
|
73
|
-
end
|
|
74
95
|
|
|
75
96
|
module ClassMethods #:nodoc:
|
|
76
97
|
@@custom_error_messages_d = {}
|
|
@@ -137,10 +158,9 @@ end
|
|
|
137
158
|
@columns = nil
|
|
138
159
|
end
|
|
139
160
|
unless @columns
|
|
140
|
-
@columns =
|
|
161
|
+
@columns = columns_without_gettext
|
|
141
162
|
@columns.each {|column|
|
|
142
163
|
column.table_class = self
|
|
143
|
-
column.primary = column.name == primary_key
|
|
144
164
|
}
|
|
145
165
|
end
|
|
146
166
|
@columns
|
data/lib/gettext/locale_win32.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: locale_win32.rb,v 1.
|
|
9
|
+
$Id: locale_win32.rb,v 1.16 2007/07/03 16:57:07 mutoh Exp $
|
|
10
10
|
=end
|
|
11
11
|
|
|
12
12
|
require 'gettext/locale_table_win32'
|
|
@@ -26,6 +26,7 @@ module Locale
|
|
|
26
26
|
# * Returns the charset of the locale
|
|
27
27
|
def get_charset(locale)
|
|
28
28
|
loc = LocaleTable.find{|v| v[1] == locale.to_win}
|
|
29
|
+
loc = LocaleTable.find{|v| v[1] =~ /^#{locale.language}-/} unless loc
|
|
29
30
|
loc ? loc[2] : "CP1252"
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
You may redistribute it and/or modify it under the same
|
|
8
8
|
license terms as Ruby.
|
|
9
9
|
|
|
10
|
-
$Id: active_record.rb,v 1.
|
|
10
|
+
$Id: active_record.rb,v 1.6 2007/07/03 01:58:47 mutoh Exp $
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
require 'gettext'
|
|
@@ -141,7 +141,7 @@ module GetText
|
|
|
141
141
|
ENV["RAILS_ENV"] = @config[:db_mode]
|
|
142
142
|
require 'config/boot.rb'
|
|
143
143
|
require 'config/environment.rb'
|
|
144
|
-
require 'app/controllers/application.rb'
|
|
144
|
+
# require 'app/controllers/application.rb'
|
|
145
145
|
rescue LoadError
|
|
146
146
|
require_rails 'rubygems'
|
|
147
147
|
if Kernel.respond_to? :gem
|
data/lib/gettext/parser/ruby.rb
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
You may redistribute it and/or modify it under the same
|
|
10
10
|
license terms as Ruby.
|
|
11
11
|
|
|
12
|
-
$Id: ruby.rb,v 1.
|
|
12
|
+
$Id: ruby.rb,v 1.10 2007/07/02 16:40:18 mutoh Exp $
|
|
13
13
|
=end
|
|
14
14
|
|
|
15
15
|
require 'irb/ruby-lex.rb'
|
|
@@ -62,7 +62,7 @@ end
|
|
|
62
62
|
module GetText
|
|
63
63
|
module RubyParser
|
|
64
64
|
ID = ['gettext', '_', 'N_', 'sgettext', 's_']
|
|
65
|
-
PLURAL_ID = ['ngettext', 'n_', 'Nn_']
|
|
65
|
+
PLURAL_ID = ['ngettext', 'n_', 'Nn_', 'ns_', 'nsgettext']
|
|
66
66
|
|
|
67
67
|
module_function
|
|
68
68
|
def parse(file, targets = []) # :nodoc:
|
data/lib/gettext/poparser.rb
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#
|
|
11
11
|
# DO NOT MODIFY!!!!
|
|
12
|
-
# This file is automatically generated by racc 1.4.
|
|
12
|
+
# This file is automatically generated by racc 1.4.5
|
|
13
13
|
# from racc grammer file "src/poparser.ry".
|
|
14
14
|
#
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ module GetText
|
|
|
20
20
|
|
|
21
21
|
class PoParser < Racc::Parser
|
|
22
22
|
|
|
23
|
-
module_eval <<'..end src/poparser.ry modeval..
|
|
23
|
+
module_eval <<'..end src/poparser.ry modeval..id99edf64163', 'src/poparser.ry', 94
|
|
24
24
|
include GetText
|
|
25
25
|
GetText.bindtextdomain("rgettext")
|
|
26
26
|
|
|
@@ -56,7 +56,7 @@ module_eval <<'..end src/poparser.ry modeval..idf3e4511031', 'src/poparser.ry',
|
|
|
56
56
|
@q.push [:PLURAL_NUM, $1]
|
|
57
57
|
str = $'
|
|
58
58
|
when /\A\#~(.*)/
|
|
59
|
-
$stderr.print _("Warning: obsolete msgid
|
|
59
|
+
$stderr.print _("Warning: obsolete msgid exists.\n")
|
|
60
60
|
$stderr.print " #{$&}\n"
|
|
61
61
|
@q.push [:COMMENT, $&]
|
|
62
62
|
str = $'
|
|
@@ -92,9 +92,10 @@ module_eval <<'..end src/poparser.ry modeval..idf3e4511031', 'src/poparser.ry',
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def on_message(msgid, msgstr)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
if msgstr.size > 0
|
|
96
|
+
@data[msgid] = msgstr
|
|
97
|
+
@data.set_comment(msgid, @comments.join("\n"))
|
|
98
|
+
end
|
|
98
99
|
@comments.clear
|
|
99
100
|
end
|
|
100
101
|
|
|
@@ -103,9 +104,9 @@ module_eval <<'..end src/poparser.ry modeval..idf3e4511031', 'src/poparser.ry',
|
|
|
103
104
|
@comments << comment
|
|
104
105
|
end
|
|
105
106
|
|
|
106
|
-
..end src/poparser.ry modeval..
|
|
107
|
+
..end src/poparser.ry modeval..id99edf64163
|
|
107
108
|
|
|
108
|
-
##### racc 1.4.
|
|
109
|
+
##### racc 1.4.5 generates ###
|
|
109
110
|
|
|
110
111
|
racc_reduce_table = [
|
|
111
112
|
0, 0, :racc_error,
|
|
@@ -252,37 +253,41 @@ module_eval <<'.,.,', 'src/poparser.ry', 51
|
|
|
252
253
|
end
|
|
253
254
|
.,.,
|
|
254
255
|
|
|
255
|
-
module_eval <<'.,.,', 'src/poparser.ry',
|
|
256
|
+
module_eval <<'.,.,', 'src/poparser.ry', 62
|
|
256
257
|
def _reduce_6( val, _values, result )
|
|
257
|
-
|
|
258
|
+
if val[0].size > 0
|
|
259
|
+
result = val[0] + "\000" + val[1]
|
|
260
|
+
else
|
|
261
|
+
result = ""
|
|
262
|
+
end
|
|
258
263
|
result
|
|
259
264
|
end
|
|
260
265
|
.,.,
|
|
261
266
|
|
|
262
267
|
# reduce 7 omitted
|
|
263
268
|
|
|
264
|
-
module_eval <<'.,.,', 'src/poparser.ry',
|
|
269
|
+
module_eval <<'.,.,', 'src/poparser.ry', 70
|
|
265
270
|
def _reduce_8( val, _values, result )
|
|
266
271
|
result = val[2]
|
|
267
272
|
result
|
|
268
273
|
end
|
|
269
274
|
.,.,
|
|
270
275
|
|
|
271
|
-
module_eval <<'.,.,', 'src/poparser.ry',
|
|
276
|
+
module_eval <<'.,.,', 'src/poparser.ry', 77
|
|
272
277
|
def _reduce_9( val, _values, result )
|
|
273
278
|
on_comment(val[0])
|
|
274
279
|
result
|
|
275
280
|
end
|
|
276
281
|
.,.,
|
|
277
282
|
|
|
278
|
-
module_eval <<'.,.,', 'src/poparser.ry',
|
|
283
|
+
module_eval <<'.,.,', 'src/poparser.ry', 85
|
|
279
284
|
def _reduce_10( val, _values, result )
|
|
280
285
|
result = val.delete_if{|item| item == ""}.join
|
|
281
286
|
result
|
|
282
287
|
end
|
|
283
288
|
.,.,
|
|
284
289
|
|
|
285
|
-
module_eval <<'.,.,', 'src/poparser.ry',
|
|
290
|
+
module_eval <<'.,.,', 'src/poparser.ry', 89
|
|
286
291
|
def _reduce_11( val, _values, result )
|
|
287
292
|
result = val[0]
|
|
288
293
|
result
|
data/lib/gettext/rails.rb
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
|
7
7
|
license terms as Ruby.
|
|
8
8
|
|
|
9
|
-
$Id: rails.rb,v 1.
|
|
9
|
+
$Id: rails.rb,v 1.63 2007/07/05 16:55:59 mutoh Exp $
|
|
10
10
|
=end
|
|
11
11
|
|
|
12
12
|
require 'gettext/cgi'
|
|
13
13
|
require 'action_controller'
|
|
14
|
+
require 'gettext/rails_compat'
|
|
14
15
|
|
|
15
16
|
module GetText
|
|
16
17
|
# GetText::Rails supports Ruby on Rails.
|
|
@@ -237,11 +238,27 @@ module ActionController #:nodoc:
|
|
|
237
238
|
end
|
|
238
239
|
|
|
239
240
|
class TestRequest < AbstractRequest #:nodoc:
|
|
241
|
+
class GetTextMockCGI < CGI #:nodoc:
|
|
242
|
+
attr_accessor :stdinput, :stdoutput, :env_table
|
|
243
|
+
|
|
244
|
+
def initialize(env, input=nil)
|
|
245
|
+
self.env_table = env
|
|
246
|
+
self.stdinput = StringIO.new(input || "")
|
|
247
|
+
self.stdoutput = StringIO.new
|
|
248
|
+
|
|
249
|
+
super()
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
240
253
|
@cgi = nil
|
|
241
254
|
def cgi
|
|
242
255
|
unless @cgi
|
|
243
|
-
|
|
244
|
-
|
|
256
|
+
@cgi = GetTextMockCGI.new("REQUEST_METHOD" => "GET",
|
|
257
|
+
"QUERY_STRING" => "",
|
|
258
|
+
"REQUEST_URI" => "/",
|
|
259
|
+
"HTTP_HOST" => "www.example.com",
|
|
260
|
+
"SERVER_PORT" => "80",
|
|
261
|
+
"HTTPS" => "off")
|
|
245
262
|
end
|
|
246
263
|
@cgi
|
|
247
264
|
end
|
|
@@ -310,50 +327,64 @@ module ActionView #:nodoc:
|
|
|
310
327
|
end
|
|
311
328
|
@error_message_explanation = [single_msg, plural_msg]
|
|
312
329
|
end
|
|
313
|
-
|
|
314
|
-
def error_message_title #:nodoc:
|
|
315
|
-
if @error_message_title
|
|
316
|
-
[_(@error_message_title[0]), _(@error_message_title[1])]
|
|
317
|
-
else
|
|
318
|
-
nil
|
|
319
|
-
end
|
|
320
|
-
end
|
|
321
|
-
def error_message_explanation #:nodoc:
|
|
322
|
-
if @error_message_explanation
|
|
323
|
-
[_(@error_message_explanation[0]), _(@error_message_explanation[1])]
|
|
324
|
-
else
|
|
325
|
-
nil
|
|
326
|
-
end
|
|
327
|
-
end
|
|
328
330
|
|
|
329
|
-
def render_error_message(object, klass, record, count, options)
|
|
330
|
-
message_title = @error_message_title
|
|
331
|
-
message_explanation = @error_message_explanation
|
|
332
|
-
|
|
333
|
-
klass.content_tag("div",
|
|
334
|
-
klass.content_tag(
|
|
335
|
-
options[:header_tag] || "h2",
|
|
336
|
-
n_(message_title, count) % {:num => count, :record => record}
|
|
337
|
-
) +
|
|
338
|
-
klass.content_tag("p", n_(message_explanation, count) % {:num => count}) +
|
|
339
|
-
klass.content_tag("ul", object.errors.full_messages.collect { |msg| klass.content_tag("li", msg) }),
|
|
340
|
-
"id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
|
|
341
|
-
)
|
|
342
|
-
end
|
|
343
331
|
|
|
344
|
-
def error_messages_for(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
332
|
+
def error_messages_for(instance, objects, object_names, count, options)
|
|
333
|
+
record = ActiveRecord::Base.human_attribute_table_name_for_error(options[:object_name] || object_names[0].to_s)
|
|
334
|
+
|
|
335
|
+
message_title = instance.error_message_title(@error_message_title)
|
|
336
|
+
message_explanation = instance.error_message_explanation(@error_message_explanation)
|
|
337
|
+
|
|
338
|
+
html = {}
|
|
339
|
+
[:id, :class].each do |key|
|
|
340
|
+
if options.include?(key)
|
|
341
|
+
value = options[key]
|
|
342
|
+
html[key] = value unless value.blank?
|
|
343
|
+
else
|
|
344
|
+
html[key] = 'errorExplanation'
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
header_message = n_(message_title, count) % {:num => count, :record => record}
|
|
349
|
+
error_messages = objects.map {|object| object.errors.full_messages.map {|msg| instance.content_tag(:li, msg) } }
|
|
350
|
+
|
|
351
|
+
instance.content_tag(:div,
|
|
352
|
+
instance.content_tag(options[:header_tag] || :h2, header_message) <<
|
|
353
|
+
instance.content_tag(:p, n_(message_explanation, count) % {:num => count}) <<
|
|
354
|
+
instance.content_tag(:ul, error_messages),
|
|
355
|
+
html
|
|
356
|
+
)
|
|
352
357
|
end
|
|
353
358
|
end
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
359
|
+
|
|
360
|
+
def error_message_title(msg) #:nodoc:
|
|
361
|
+
if msg
|
|
362
|
+
[_(msg[0]), _(msg[1])]
|
|
363
|
+
else
|
|
364
|
+
nil
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def error_message_explanation(msg) #:nodoc:
|
|
369
|
+
if msg
|
|
370
|
+
[_(msg[0]), _(msg[1])]
|
|
371
|
+
else
|
|
372
|
+
nil
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
alias error_messages_for_without_localize error_messages_for #:nodoc:
|
|
377
|
+
|
|
378
|
+
def error_messages_for(*params)
|
|
379
|
+
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
|
|
380
|
+
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
|
|
381
|
+
object_names = params.dup
|
|
382
|
+
count = objects.inject(0) {|sum, object| sum + object.errors.count }
|
|
383
|
+
if count.zero?
|
|
384
|
+
''
|
|
385
|
+
else
|
|
386
|
+
L10n.error_messages_for(self, objects, object_names, count, options)
|
|
387
|
+
end
|
|
357
388
|
end
|
|
358
389
|
end
|
|
359
390
|
|
|
@@ -363,17 +394,19 @@ module ActionView #:nodoc:
|
|
|
363
394
|
|
|
364
395
|
# This is FAKE constant. The messages are found by rgettext as the msgid.
|
|
365
396
|
MESSAGESS = [N_('less than 5 seconds'), N_('less than 10 seconds'), N_('less than 20 seconds'),
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
397
|
+
N_('half a minute'), N_('less than a minute'), N_('about 1 month'),
|
|
398
|
+
N_('about 1 year'), N_('over 2 years')]
|
|
399
|
+
NMINUTES = [/^(\d+) minutes?$/, Nn_('1 minute', '%{num} minutes')]
|
|
400
|
+
NHOURS = [/^about (\d+) hours?$/, Nn_('about 1 hour', 'about %{num} hours')]
|
|
401
|
+
NDAYS = [/^(\d+) days?$/, Nn_('1 day', '%{num} days')]
|
|
402
|
+
NMONTHS = [/^(\d+) months?$/, Nn_('1 month', '%{num} months')]
|
|
370
403
|
|
|
371
404
|
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
|
|
372
405
|
textdomain("rails")
|
|
373
406
|
|
|
374
407
|
msg = distance_of_time_in_words_without_locale(from_time, to_time, include_seconds)
|
|
375
408
|
match = false
|
|
376
|
-
[
|
|
409
|
+
[NMINUTES, NHOURS, NDAYS, NMONTHS].each do |regexp, nn|
|
|
377
410
|
if regexp =~ msg
|
|
378
411
|
match = true
|
|
379
412
|
msg = n_(nn, $1.to_i) % {:num => $1}
|
|
@@ -416,8 +449,29 @@ if defined? ActionMailer
|
|
|
416
449
|
part.body = NKF.nkf('-j', part.body)
|
|
417
450
|
end
|
|
418
451
|
end
|
|
419
|
-
|
|
452
|
+
@mail
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
end
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
module ActionController #:nodoc: all
|
|
459
|
+
module Caching
|
|
460
|
+
module Fragments
|
|
461
|
+
def fragment_cache_key_with_gettext(name)
|
|
462
|
+
fragment_cache_key_without_gettext(name).gsub('?', '.').gsub(/:/, ".") << "_#{Locale.current}"
|
|
463
|
+
end
|
|
464
|
+
alias_method_chain :fragment_cache_key, :gettext
|
|
465
|
+
|
|
466
|
+
def expire_fragment_with_gettext(name, options = nil)
|
|
467
|
+
return unless perform_caching
|
|
468
|
+
|
|
469
|
+
key = %r{#{fragment_cache_key_without_gettext(name).gsub('?', '.').gsub(/:/, ".")}}
|
|
470
|
+
self.class.benchmark "Expired fragments matching: #{key.source}" do
|
|
471
|
+
fragment_cache_store.delete_matched(key, options)
|
|
472
|
+
end
|
|
420
473
|
end
|
|
474
|
+
alias_method_chain :expire_fragment, :gettext
|
|
421
475
|
end
|
|
422
476
|
end
|
|
423
477
|
end
|
|
@@ -432,7 +486,7 @@ end
|
|
|
432
486
|
|
|
433
487
|
|
|
434
488
|
if ::RAILS_ENV == "development"
|
|
435
|
-
GetText
|
|
489
|
+
GetText.cached = false
|
|
436
490
|
end
|
|
437
491
|
|
|
438
492
|
require 'gettext/active_record'
|