gettext 1.9.0-mswin32 → 1.10.0-mswin32
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/ext/gettext/Makefile +2 -2
- data/ext/gettext/locale_system.o +0 -0
- data/ext/gettext/locale_system.so +0 -0
- 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 +303 -298
- 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/lib/gettext.rb +119 -37
- data/lib/locale_system.so +0 -0
- 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/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/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/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/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/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/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/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 +317 -20
- data/ext/gettext/locale_system-i386-mswin32.def +0 -2
- data/ext/gettext/locale_system-i386-mswin32.exp +0 -0
- data/ext/gettext/locale_system-i386-mswin32.lib +0 -0
- data/ext/gettext/locale_system-i386-mswin32.pdb +0 -0
- data/ext/gettext/locale_system.obj +0 -0
- data/ext/gettext/vc70.pdb +0 -0
- data/samples/rails/locale/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/el/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/ru/LC_MESSAGES/gettext_plugin.mo +0 -0
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'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# This file is for Rails-1.1.6.
|
3
|
+
# From activesupport-1.4.1/lib/active_support/core_ext/module/aliasing.rb
|
4
|
+
#
|
5
|
+
class Module
|
6
|
+
unless defined? alias_method_chain
|
7
|
+
def alias_method_chain(target, feature)
|
8
|
+
# Strip out punctuation on predicates or bang methods since
|
9
|
+
# e.g. target?_without_feature is not a valid method name.
|
10
|
+
aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
|
11
|
+
yield(aliased_target, punctuation) if block_given?
|
12
|
+
alias_method "#{aliased_target}_without_#{feature}#{punctuation}", target
|
13
|
+
alias_method target, "#{aliased_target}_with_#{feature}#{punctuation}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/gettext/rgettext.rb
CHANGED
@@ -25,7 +25,7 @@ module GetText
|
|
25
25
|
|
26
26
|
# constant values
|
27
27
|
VERSION = GetText::VERSION
|
28
|
-
DATE = %w($Date:
|
28
|
+
DATE = %w($Date: 2007/07/02 16:40:18 $)[1]
|
29
29
|
MAX_LINE_LEN = 70
|
30
30
|
|
31
31
|
@ex_parsers = []
|
@@ -123,6 +123,41 @@ msgstr ""
|
|
123
123
|
str
|
124
124
|
end
|
125
125
|
|
126
|
+
def normalize(ary) # :nodoc:
|
127
|
+
used_plural_msgs = []
|
128
|
+
ary.select{|item| item[0].include? "\000"}.each do |plural_msg|
|
129
|
+
next if used_plural_msgs.include?(plural_msg[0])
|
130
|
+
|
131
|
+
key = plural_msg[0].split("\000")[0]
|
132
|
+
|
133
|
+
ary.dup.each do |single_msg|
|
134
|
+
if single_msg[0] == key or
|
135
|
+
(single_msg[0] =~ /#{Regexp.quote(key)}\000/ and
|
136
|
+
single_msg[0] != plural_msg[0])
|
137
|
+
if single_msg[0] != key
|
138
|
+
warn %Q[Warning: n_("#{plural_msg[0].gsub(/\000/, '", "')}") and n_("#{single_msg[0].gsub(/\000/, '", "')}") are duplicated. First msgid was used.]
|
139
|
+
used_plural_msgs << single_msg[0]
|
140
|
+
end
|
141
|
+
|
142
|
+
single_msg[1..-1].each do |line_info|
|
143
|
+
plural_msg << line_info
|
144
|
+
fname = line_info.split(/:/)[0]
|
145
|
+
sorted = plural_msg[1..-1].select{|l| l.split(/:/)[0].include?(fname)}.collect{|l|
|
146
|
+
aline = l.split(/:/)
|
147
|
+
[aline[0], aline[1] =~ /[0-9]+/ ? aline[1].to_i : aline[1]]
|
148
|
+
}.sort.collect{|l| "#{l[0]}:#{l[1]}"}
|
149
|
+
plural_msg.delete_if{|i| sorted.include?(i)}
|
150
|
+
sorted.each {|i|
|
151
|
+
plural_msg << i
|
152
|
+
}
|
153
|
+
end
|
154
|
+
ary.delete(single_msg)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
ary.collect{|i| i.uniq}
|
159
|
+
end
|
160
|
+
|
126
161
|
def parse(files) # :nodoc:
|
127
162
|
ary = []
|
128
163
|
files.each do |file|
|
@@ -138,8 +173,7 @@ msgstr ""
|
|
138
173
|
raise
|
139
174
|
end
|
140
175
|
end
|
141
|
-
|
142
|
-
ary
|
176
|
+
normalize(ary)
|
143
177
|
end
|
144
178
|
|
145
179
|
def check_options # :nodoc:
|
data/lib/gettext/textdomain.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
You may redistribute it and/or modify it under the same
|
11
11
|
license terms as Ruby.
|
12
12
|
|
13
|
-
$Id: textdomain.rb,v 1.
|
13
|
+
$Id: textdomain.rb,v 1.22 2007/07/02 16:40:18 mutoh Exp $
|
14
14
|
=end
|
15
15
|
|
16
16
|
require 'gettext/string'
|
@@ -116,14 +116,34 @@ module GetText
|
|
116
116
|
# * Returns: the translated string or nil if not found.
|
117
117
|
def gettext(msgid)
|
118
118
|
return "" if msgid == "" or msgid.nil?
|
119
|
-
|
120
|
-
|
119
|
+
return nil unless @current_mo
|
120
|
+
if @current_mo[msgid] and (@current_mo[msgid].size > 0)
|
121
|
+
@current_mo[msgid]
|
122
|
+
elsif msgid.include?("\000")
|
123
|
+
ret = nil
|
124
|
+
msgid_single = msgid.split("\000")[0]
|
125
|
+
@current_mo.each{|key, val|
|
126
|
+
if key =~ /^#{Regexp.quote(msgid_single)}\000/
|
127
|
+
# Usually, this is not caused to make po-files from rgettext.
|
128
|
+
warn %Q[Warning: n_("#{msgid_single}", "#{msgid.split("\000")[1]}") and n_("#{key.gsub(/\000/, '", "')}") are duplicated.] if $DEBUG
|
129
|
+
ret = val
|
130
|
+
break
|
131
|
+
end
|
132
|
+
}
|
133
|
+
ret
|
121
134
|
else
|
122
|
-
nil
|
135
|
+
ret = nil
|
136
|
+
@current_mo.each{|key, val|
|
137
|
+
if key =~ /^#{Regexp.quote(msgid)}\000/
|
138
|
+
ret = val.split("\000")[0]
|
139
|
+
break
|
140
|
+
end
|
141
|
+
}
|
142
|
+
ret
|
123
143
|
end
|
124
144
|
end
|
125
145
|
|
126
|
-
# Gets the translated string.
|
146
|
+
# Gets the translated string. (Deprecated. Don't call this method directly)
|
127
147
|
# * msgid: the original message(single).
|
128
148
|
# * msgid: the original message(plural).
|
129
149
|
# * n: the number
|
@@ -132,7 +152,7 @@ module GetText
|
|
132
152
|
key = msgid + "\000" + msgid_plural
|
133
153
|
msg = gettext(key)
|
134
154
|
if ! msg
|
135
|
-
nil
|
155
|
+
nil # do nothing.
|
136
156
|
elsif msg == key
|
137
157
|
msg = n == 1 ? msgid : msgid_plural
|
138
158
|
elsif msg.include?("\000")
|
@@ -151,6 +171,25 @@ module GetText
|
|
151
171
|
msg
|
152
172
|
end
|
153
173
|
|
174
|
+
def ngettext_data(msgid, msgid_plural) #:nodoc:
|
175
|
+
key = msgid + "\000" + msgid_plural
|
176
|
+
msg = gettext(key)
|
177
|
+
ret = nil
|
178
|
+
if ! msg
|
179
|
+
ret = nil
|
180
|
+
elsif msg == key
|
181
|
+
ret = nil
|
182
|
+
elsif msg.include?("\000")
|
183
|
+
# [[msgstr[0], msgstr[1], msgstr[2],...], cond]
|
184
|
+
cond = @current_mo ? @current_mo.plural : nil
|
185
|
+
cond ||= "n != 1"
|
186
|
+
ret = [msg.split("\000"), cond]
|
187
|
+
else
|
188
|
+
ret = [[msg], "0"]
|
189
|
+
end
|
190
|
+
ret
|
191
|
+
end
|
192
|
+
|
154
193
|
# Compare this object has the same name, topdir and locale.
|
155
194
|
# * name: the textdomain name
|
156
195
|
# * topdir: the top directory of mo files or nil.
|
data/lib/gettext/utils.rb
CHANGED
@@ -7,6 +7,13 @@
|
|
7
7
|
license terms as Ruby.
|
8
8
|
=end
|
9
9
|
|
10
|
+
require 'rbconfig'
|
11
|
+
if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
|
12
|
+
ENV['PATH'] = %w(bin lib).collect{|dir|
|
13
|
+
"#{Config::CONFIG["prefix"]}\\lib\\GTK\\#{dir};"
|
14
|
+
}.join('') + ENV['PATH']
|
15
|
+
end
|
16
|
+
|
10
17
|
require 'gettext/rgettext'
|
11
18
|
require 'gettext/rmsgfmt'
|
12
19
|
require 'fileutils'
|
data/lib/gettext/version.rb
CHANGED
data/lib/gettext.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
=begin
|
2
2
|
gettext.rb - GetText module
|
3
3
|
|
4
|
-
Copyright (C) 2001-
|
4
|
+
Copyright (C) 2001-2007 Masao Mutoh
|
5
5
|
Copyright (C) 2001-2003 Masahiro Sakai
|
6
6
|
|
7
7
|
Masao Mutoh <mutoh@highway.ne.jp>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
You may redistribute it and/or modify it under the same
|
11
11
|
license terms as Ruby.
|
12
12
|
|
13
|
-
$Id: gettext.rb,v 1.
|
13
|
+
$Id: gettext.rb,v 1.27 2007/07/05 05:29:28 mutoh Exp $
|
14
14
|
=end
|
15
15
|
|
16
16
|
require 'rbconfig'
|
@@ -29,6 +29,29 @@ module GetText
|
|
29
29
|
mod.extend self
|
30
30
|
end
|
31
31
|
|
32
|
+
@@__cached = true
|
33
|
+
|
34
|
+
# Set the value whether cache messages or not.
|
35
|
+
# true to cache messages, otherwise false.
|
36
|
+
#
|
37
|
+
# Default is true. If $DEBUG is false, messages are not checked even if
|
38
|
+
# this value is true.
|
39
|
+
def cached=(val)
|
40
|
+
@@__cached = val
|
41
|
+
GetText::TextDomain.check_mo = ! val
|
42
|
+
end
|
43
|
+
|
44
|
+
# Return the cached value.
|
45
|
+
def cached?
|
46
|
+
@@__cached
|
47
|
+
end
|
48
|
+
|
49
|
+
# Clear the cached messages.
|
50
|
+
def clear_cache
|
51
|
+
@@__cache_msgids = {}
|
52
|
+
@@__cache_nmsgids = {}
|
53
|
+
end
|
54
|
+
|
32
55
|
@@__textdomainmanagers = Hash.new
|
33
56
|
|
34
57
|
# call-seq:
|
@@ -156,6 +179,8 @@ module GetText
|
|
156
179
|
((ret + klass.ancestors + [GetText]) & @@__textdomainmanagers.keys).uniq
|
157
180
|
end
|
158
181
|
|
182
|
+
@@__cache_msgids = {}
|
183
|
+
|
159
184
|
# call-seq:
|
160
185
|
# gettext(msgid)
|
161
186
|
# _(msgid)
|
@@ -164,14 +189,44 @@ module GetText
|
|
164
189
|
# * msgid: the message id.
|
165
190
|
# * Returns: localized text by msgid. If there are not binded mo-file, it will return msgid.
|
166
191
|
def gettext(msgid)
|
167
|
-
|
192
|
+
sgettext(msgid, nil)
|
193
|
+
end
|
194
|
+
|
195
|
+
# call-seq:
|
196
|
+
# sgettext(msgid, div = '|')
|
197
|
+
# s_(msgid, div = '|')
|
198
|
+
#
|
199
|
+
# Translates msgid, but if there are no localized text,
|
200
|
+
# it returns a last part of msgid separeted "div".
|
201
|
+
#
|
202
|
+
# * msgid: the message id.
|
203
|
+
# * div: separator or nil.
|
204
|
+
# * Returns: the localized text by msgid. If there are no localized text,
|
205
|
+
# it returns a last part of msgid separeted "div".
|
206
|
+
# See: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC151
|
207
|
+
def sgettext(msgid, div = '|')
|
208
|
+
cached_key = [bound_target, Locale.current, msgid]
|
209
|
+
if (@@__cached or ! $DEBUG)
|
210
|
+
if @@__cache_msgids.keys.include?(cached_key)
|
211
|
+
return @@__cache_msgids[cached_key]
|
212
|
+
end
|
213
|
+
end
|
214
|
+
msg = nil
|
168
215
|
each_textdomain {|textdomain|
|
169
|
-
|
170
|
-
break if
|
216
|
+
msg = textdomain.gettext(msgid)
|
217
|
+
break if msg
|
171
218
|
}
|
172
|
-
|
219
|
+
msg ||= msgid
|
220
|
+
if div and msg == msgid
|
221
|
+
if index = msg.rindex(div)
|
222
|
+
msg = msg[(index + 1)..-1]
|
223
|
+
end
|
224
|
+
end
|
225
|
+
@@__cache_msgids[cached_key] = msg
|
173
226
|
end
|
174
227
|
|
228
|
+
@@__cache_nmsgids = {}
|
229
|
+
|
175
230
|
# call-seq:
|
176
231
|
# ngettext(msgid, msgid_plural, n)
|
177
232
|
# ngettext(msgids, n) # msgids = [msgid, msgid_plural]
|
@@ -187,21 +242,7 @@ module GetText
|
|
187
242
|
# * Returns: the localized text which key is msgid_plural if n is plural(follow plural-rule) or msgid.
|
188
243
|
# "plural-rule" is defined in po-file.
|
189
244
|
def ngettext(arg1, arg2, arg3 = nil)
|
190
|
-
|
191
|
-
msgid = arg1[0]
|
192
|
-
msgid_plural = arg1[1]
|
193
|
-
n = arg2
|
194
|
-
else
|
195
|
-
msgid = arg1
|
196
|
-
msgid_plural = arg2
|
197
|
-
n = arg3
|
198
|
-
end
|
199
|
-
ret = nil
|
200
|
-
each_textdomain {|textdomain|
|
201
|
-
ret = textdomain.ngettext(msgid, msgid_plural, n)
|
202
|
-
break if ret
|
203
|
-
}
|
204
|
-
ret ? ret : (n == 1 ? msgid : msgid_plural)
|
245
|
+
nsgettext(arg1, arg2, arg3, nil)
|
205
246
|
end
|
206
247
|
|
207
248
|
# This function does nothing. But it is required in order to recognize the msgid by rgettext.
|
@@ -219,26 +260,66 @@ module GetText
|
|
219
260
|
[msgid, msgid_plural]
|
220
261
|
end
|
221
262
|
|
263
|
+
|
222
264
|
# call-seq:
|
223
|
-
#
|
224
|
-
#
|
265
|
+
# nsgettext(msgid, msgid_plural, n, div = "|")
|
266
|
+
# nsgettext(msgids, n, div = "|") # msgids = [msgid, msgid_plural]
|
267
|
+
# n_(msgid, msgid_plural, n, div = "|")
|
268
|
+
# n_(msgids, n, div = "|") # msgids = [msgid, msgid_plural]
|
225
269
|
#
|
226
|
-
#
|
270
|
+
# The nsgettext is similar to the ngettext.
|
271
|
+
# But if there are no localized text,
|
227
272
|
# it returns a last part of msgid separeted "div".
|
228
273
|
#
|
229
|
-
# * msgid: the
|
230
|
-
# *
|
231
|
-
# *
|
232
|
-
#
|
233
|
-
#
|
234
|
-
def
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
274
|
+
# * msgid: the singular form with "div". (e.g. "Special|An apple")
|
275
|
+
# * msgid_plural: the plural form. (e.g. "%{num} Apples")
|
276
|
+
# * n: a number used to determine the plural form.
|
277
|
+
# * Returns: the localized text which key is msgid_plural if n is plural(follow plural-rule) or msgid.
|
278
|
+
# "plural-rule" is defined in po-file.
|
279
|
+
def nsgettext(arg1, arg2, arg3 = "|", arg4 = "|")
|
280
|
+
if arg1.kind_of?(Array)
|
281
|
+
msgid = arg1[0]
|
282
|
+
msgid_plural = arg1[1]
|
283
|
+
n = arg2
|
284
|
+
if arg3 and arg3.kind_of? Numeric
|
285
|
+
raise ArgumentError, _("3rd parmeter is wrong: value = %{number}") % {:number => arg3}
|
239
286
|
end
|
287
|
+
div = arg3
|
288
|
+
else
|
289
|
+
msgid = arg1
|
290
|
+
msgid_plural = arg2
|
291
|
+
n = arg3
|
292
|
+
div = arg4
|
240
293
|
end
|
241
|
-
|
294
|
+
|
295
|
+
cached_key = [bound_target, Locale.current, msgid + "\000" + msgid_plural]
|
296
|
+
msgs = nil
|
297
|
+
if (@@__cached or ! $DEBUG)
|
298
|
+
if @@__cache_nmsgids.keys.include?(cached_key)
|
299
|
+
msgs = @@__cache_nmsgids[cached_key] # [msgstr, cond_as_string]
|
300
|
+
end
|
301
|
+
end
|
302
|
+
unless msgs
|
303
|
+
each_textdomain {|textdomain|
|
304
|
+
msgs = textdomain.ngettext_data(msgid, msgid_plural)
|
305
|
+
break if msgs
|
306
|
+
}
|
307
|
+
msgs = [[msgid, msgid_plural], "n != 1"] unless msgs
|
308
|
+
@@__cache_nmsgids[cached_key] = msgs
|
309
|
+
end
|
310
|
+
msgstrs = msgs[0]
|
311
|
+
if div and msgstrs[0] == msgid
|
312
|
+
if index = msgstrs[0].rindex(div)
|
313
|
+
msgstrs[0] = msgstrs[0][(index + 1)..-1]
|
314
|
+
end
|
315
|
+
end
|
316
|
+
plural = eval(msgs[1])
|
317
|
+
if plural.kind_of?(Numeric)
|
318
|
+
ret = msgstrs[plural]
|
319
|
+
else
|
320
|
+
ret = plural ? msgstrs[1] : msgstrs[0]
|
321
|
+
end
|
322
|
+
ret
|
242
323
|
end
|
243
324
|
|
244
325
|
# Sets the current locale to the current class/module
|
@@ -391,9 +472,10 @@ module GetText
|
|
391
472
|
alias :_ :gettext #:nodoc:
|
392
473
|
alias :n_ :ngettext #:nodoc:
|
393
474
|
alias :s_ :sgettext #:nodoc:
|
475
|
+
alias :ns_ :nsgettext #:nodoc:
|
394
476
|
|
395
|
-
module_function :bindtextdomain, :textdomain, :each_textdomain,
|
396
|
-
:N_, :gettext, :_, :ngettext, :n_, :sgettext, :s_, :bound_target, :bound_targets,
|
477
|
+
module_function :bindtextdomain, :textdomain, :each_textdomain, :cached=, :cached?, :clear_cache,
|
478
|
+
:N_, :gettext, :_, :ngettext, :n_, :sgettext, :s_, :nsgettext, :ns_, :bound_target, :bound_targets,
|
397
479
|
:setlocale, :set_locale, :locale=, :set_locale_all, :locale, :charset=, :set_charset,
|
398
480
|
:set_output_charset, :output_charset=, :output_charset, :current_textdomain_info
|
399
481
|
end
|
data/lib/locale_system.so
CHANGED
Binary file
|