gettext_rails 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +55 -0
- data/ChangeLog +4 -0
- data/README.rdoc +173 -0
- data/Rakefile +113 -0
- data/data/locale/bg/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/bs/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/de/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/el/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/eo/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/es/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/et/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/hr/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/hu/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/it/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/lv/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/nb/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/sr/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/ua/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/gettext_rails.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/gettext_rails.mo +0 -0
- data/lib/gettext_rails.rb +33 -0
- data/lib/gettext_rails/action_controller.rb +104 -0
- data/lib/gettext_rails/action_mailer.rb +45 -0
- data/lib/gettext_rails/action_view.rb +16 -0
- data/lib/gettext_rails/action_view/active_record_helper.rb +109 -0
- data/lib/gettext_rails/action_view/date_helper.rb +48 -0
- data/lib/gettext_rails/action_view/form_builder.rb +26 -0
- data/lib/gettext_rails/tools.rb +22 -0
- data/lib/gettext_rails/version.rb +14 -0
- data/po/bg/gettext_rails.po +89 -0
- data/po/bs/gettext_rails.po +98 -0
- data/po/ca/gettext_rails.po +90 -0
- data/po/cs/gettext_rails.po +102 -0
- data/po/de/gettext_rails.po +94 -0
- data/po/el/gettext_rails.po +89 -0
- data/po/eo/gettext_rails.po +90 -0
- data/po/es/gettext_rails.po +90 -0
- data/po/et/gettext_rails.po +90 -0
- data/po/fr/gettext_rails.po +94 -0
- data/po/gettext_rails.pot +87 -0
- data/po/hr/gettext_rails.po +99 -0
- data/po/hu/gettext_rails.po +90 -0
- data/po/it/gettext_rails.po +89 -0
- data/po/ja/gettext_rails.po +90 -0
- data/po/ko/gettext_rails.po +87 -0
- data/po/lv/gettext_rails.po +95 -0
- data/po/nb/gettext_rails.po +91 -0
- data/po/nl/gettext_rails.po +91 -0
- data/po/pt_BR/gettext_rails.po +91 -0
- data/po/ru/gettext_rails.po +98 -0
- data/po/sr/gettext_rails.po +98 -0
- data/po/test.rb +11 -0
- data/po/ua/gettext_rails.po +104 -0
- data/po/vi/gettext_rails.po +90 -0
- data/po/zh/gettext_rails.po +86 -0
- data/po/zh_TW/gettext_rails.po +86 -0
- data/replace.rb +21 -0
- data/sample/README +80 -0
- data/sample/Rakefile +11 -0
- data/sample/app/controllers/application_controller.rb +37 -0
- data/sample/app/controllers/articles_controller.rb +97 -0
- data/sample/app/helpers/application_helper.rb +3 -0
- data/sample/app/helpers/articles_helper.rb +60 -0
- data/sample/app/models/article.rb +16 -0
- data/sample/app/views/articles/edit.html.erb +22 -0
- data/sample/app/views/articles/index.html.erb +18 -0
- data/sample/app/views/articles/new.html.erb +20 -0
- data/sample/app/views/articles/show.html.erb +7 -0
- data/sample/app/views/layouts/articles.html.erb +27 -0
- data/sample/config/boot.rb +109 -0
- data/sample/config/database.yml +22 -0
- data/sample/config/environment.rb +45 -0
- data/sample/config/environments/development.rb +17 -0
- data/sample/config/environments/production.rb +27 -0
- data/sample/config/environments/test.rb +27 -0
- data/sample/config/initializers/backtrace_silencers.rb +7 -0
- data/sample/config/initializers/inflections.rb +10 -0
- data/sample/config/initializers/mime_types.rb +5 -0
- data/sample/config/initializers/new_rails_defaults.rb +19 -0
- data/sample/config/initializers/session_store.rb +15 -0
- data/sample/config/routes.rb +45 -0
- data/sample/db/development.sqlite3 +0 -0
- data/sample/db/production.sqlite3 +0 -0
- data/sample/db/schema.rb +19 -0
- data/sample/db/test.sqlite3 +0 -0
- data/sample/doc/README_FOR_APP +2 -0
- data/sample/lib/tasks/gettext.rake +13 -0
- data/sample/locale/bg/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/bs/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/ca/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/cs/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/de/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/el/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/eo/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/es/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/fr/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/hr/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/hu/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/it/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/ja/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/ko/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/lv/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/nb/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/nl/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/ru/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/sr/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/ua/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/vi/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/zh/LC_MESSAGES/blog.mo +0 -0
- data/sample/locale/zh_TW/LC_MESSAGES/blog.mo +0 -0
- data/sample/log/development.log +635 -0
- data/sample/log/production.log +79475 -0
- data/sample/log/test.log +1592 -0
- data/sample/po/bg/blog.po +101 -0
- data/sample/po/blog.pot +102 -0
- data/sample/po/bs/blog.po +103 -0
- data/sample/po/ca/blog.po +101 -0
- data/sample/po/cs/blog.po +104 -0
- data/sample/po/de/blog.po +104 -0
- data/sample/po/el/blog.po +102 -0
- data/sample/po/en/blog.po +103 -0
- data/sample/po/eo/blog.po +102 -0
- data/sample/po/eo/tmp.patch +21 -0
- data/sample/po/es/blog.po +101 -0
- data/sample/po/fr/blog.po +102 -0
- data/sample/po/hr/blog.po +102 -0
- data/sample/po/hu/blog.po +101 -0
- data/sample/po/it/blog.po +102 -0
- data/sample/po/ja/blog.po +101 -0
- data/sample/po/ko/blog.po +102 -0
- data/sample/po/lv/blog.po +103 -0
- data/sample/po/nb/blog.po +102 -0
- data/sample/po/nl/blog.po +102 -0
- data/sample/po/pt_BR/blog.po +102 -0
- data/sample/po/ru/blog.po +102 -0
- data/sample/po/sr/blog.po +103 -0
- data/sample/po/ua/blog.po +105 -0
- data/sample/po/vi/blog.po +102 -0
- data/sample/po/zh/blog.po +101 -0
- data/sample/po/zh_TW/blog.po +103 -0
- data/sample/public/404.html +30 -0
- data/sample/public/422.html +30 -0
- data/sample/public/500.html +33 -0
- data/sample/public/favicon.ico +0 -0
- data/sample/public/images/rails.png +0 -0
- data/sample/public/index.html +275 -0
- data/sample/public/javascripts/application.js +2 -0
- data/sample/public/javascripts/controls.js +963 -0
- data/sample/public/javascripts/dragdrop.js +973 -0
- data/sample/public/javascripts/effects.js +1128 -0
- data/sample/public/javascripts/prototype.js +4320 -0
- data/sample/public/robots.txt +5 -0
- data/sample/public/stylesheets/blog.css +136 -0
- data/sample/public/stylesheets/scaffold.css +54 -0
- data/sample/script/about +4 -0
- data/sample/script/console +3 -0
- data/sample/script/dbconsole +3 -0
- data/sample/script/destroy +3 -0
- data/sample/script/generate +3 -0
- data/sample/script/performance/benchmarker +3 -0
- data/sample/script/performance/profiler +3 -0
- data/sample/script/plugin +3 -0
- data/sample/script/runner +3 -0
- data/sample/script/server +3 -0
- data/sample/test/fixtures/articles.yml +11 -0
- data/sample/test/functional/articles_controller_test.rb +45 -0
- data/sample/test/performance/browsing_test.rb +9 -0
- data/sample/test/result/en/list.html +69 -0
- data/sample/test/test_helper.rb +38 -0
- data/sample/test/unit/article_test.rb +8 -0
- data/sample/test/unit/helpers/articles_helper_test.rb +4 -0
- data/sample/vendor/plugins/lang_helper/README +17 -0
- data/sample/vendor/plugins/lang_helper/Rakefile +17 -0
- data/sample/vendor/plugins/lang_helper/init.rb +21 -0
- data/sample/vendor/plugins/lang_helper/lib/lang_helper.rb +32 -0
- data/sample/vendor/plugins/lang_helper/locale/bg/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/bs/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/ca/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/cs/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/de/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/el/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/eo/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/es/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/fr/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/hr/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/hu/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/it/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/ja/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/ko/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/lv/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/nb/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/nl/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/pt_BR/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/ru/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/sr/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/ua/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/vi/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/zh/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/locale/zh_TW/LC_MESSAGES/lang_helper.mo +0 -0
- data/sample/vendor/plugins/lang_helper/po/bg/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/bs/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/ca/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/cs/lang_helper.po +29 -0
- data/sample/vendor/plugins/lang_helper/po/de/lang_helper.po +29 -0
- data/sample/vendor/plugins/lang_helper/po/el/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/eo/lang_helper.po +28 -0
- data/sample/vendor/plugins/lang_helper/po/es/lang_helper.po +28 -0
- data/sample/vendor/plugins/lang_helper/po/fr/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/hr/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/hu/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/it/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/ja/lang_helper.po +28 -0
- data/sample/vendor/plugins/lang_helper/po/ko/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/lang_helper.pot +28 -0
- data/sample/vendor/plugins/lang_helper/po/lv/lang_helper.po +28 -0
- data/sample/vendor/plugins/lang_helper/po/nb/lang_helper.po +29 -0
- data/sample/vendor/plugins/lang_helper/po/nl/lang_helper.po +28 -0
- data/sample/vendor/plugins/lang_helper/po/pt_BR/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/ru/lang_helper.po +25 -0
- data/sample/vendor/plugins/lang_helper/po/sr/lang_helper.po +28 -0
- data/sample/vendor/plugins/lang_helper/po/ua/lang_helper.po +30 -0
- data/sample/vendor/plugins/lang_helper/po/vi/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/zh/lang_helper.po +27 -0
- data/sample/vendor/plugins/lang_helper/po/zh_TW/lang_helper.po +29 -0
- data/test/README +6 -0
- data/test/Rakefile +27 -0
- data/test/app/controllers/application_controller.rb +18 -0
- data/test/app/controllers/articles_controller.rb +114 -0
- data/test/app/controllers/mailers_controller.rb +18 -0
- data/test/app/controllers/users_controller.rb +19 -0
- data/test/app/helpers/application_helper.rb +3 -0
- data/test/app/helpers/articles_helper.rb +2 -0
- data/test/app/models/article.rb +9 -0
- data/test/app/models/human_resources/resume.rb +3 -0
- data/test/app/models/mailer.rb +38 -0
- data/test/app/models/user.rb +4 -0
- data/test/app/models/user_observer.rb +7 -0
- data/test/app/views/articles/_form.html.erb +13 -0
- data/test/app/views/articles/_form_fr.html.erb +1 -0
- data/test/app/views/articles/active_form_error.html.erb +1 -0
- data/test/app/views/articles/change_title_error_messages_for.html.erb +15 -0
- data/test/app/views/articles/edit.html.erb +9 -0
- data/test/app/views/articles/list.html.erb +25 -0
- data/test/app/views/articles/list_fr.html.erb +1 -0
- data/test/app/views/articles/multi_error_messages_for.html.erb +19 -0
- data/test/app/views/articles/new.html.erb +8 -0
- data/test/app/views/articles/show.html.erb +9 -0
- data/test/app/views/layouts/application.html.erb +16 -0
- data/test/app/views/layouts/mailers.html.erb +20 -0
- data/test/app/views/layouts/users.html.erb +14 -0
- data/test/app/views/mailer/coverpage.html.erb +6 -0
- data/test/app/views/mailer/coverpage_fr.html.erb +6 -0
- data/test/app/views/mailer/index.html.erb +1 -0
- data/test/app/views/mailer/singlepart.html.erb +3 -0
- data/test/app/views/mailer/singlepart_fr.html.erb +3 -0
- data/test/app/views/users/custom_error_message.html.erb +13 -0
- data/test/app/views/users/custom_error_message_fr.html.erb +13 -0
- data/test/app/views/users/distance_of_time_in_words.html.erb +18 -0
- data/test/config/boot.rb +109 -0
- data/test/config/database.yml +22 -0
- data/test/config/environment.rb +45 -0
- data/test/config/environments/development.rb +17 -0
- data/test/config/environments/production.rb +27 -0
- data/test/config/environments/test.rb +27 -0
- data/test/config/initializers/backtrace_silencers.rb +7 -0
- data/test/config/initializers/inflections.rb +10 -0
- data/test/config/initializers/mime_types.rb +5 -0
- data/test/config/initializers/new_rails_defaults.rb +19 -0
- data/test/config/initializers/session_store.rb +15 -0
- data/test/config/routes.rb +13 -0
- data/test/db/development.sqlite3 +0 -0
- data/test/db/schema.rb +45 -0
- data/test/db/test.sqlite3 +0 -0
- data/test/doc/README_FOR_APP +2 -0
- data/test/locale/ja/LC_MESSAGES/rails_test.mo +0 -0
- data/test/log/development.log +1284 -0
- data/test/log/test.log +5595 -0
- data/test/po/ja/rails_test.po +206 -0
- data/test/po/rails_test.pot +206 -0
- data/test/public/404.html +30 -0
- data/test/public/422.html +30 -0
- data/test/public/500.html +33 -0
- data/test/public/favicon.ico +0 -0
- data/test/public/images/rails.png +0 -0
- data/test/public/index.html +28 -0
- data/test/public/javascripts/application.js +2 -0
- data/test/public/javascripts/controls.js +963 -0
- data/test/public/javascripts/dragdrop.js +973 -0
- data/test/public/javascripts/effects.js +1128 -0
- data/test/public/javascripts/prototype.js +4320 -0
- data/test/public/robots.txt +5 -0
- data/test/public/stylesheets/blog.css +136 -0
- data/test/public/stylesheets/scaffold.css +54 -0
- data/test/script/about +4 -0
- data/test/script/console +3 -0
- data/test/script/dbconsole +3 -0
- data/test/script/destroy +3 -0
- data/test/script/generate +3 -0
- data/test/script/performance/benchmarker +3 -0
- data/test/script/performance/profiler +3 -0
- data/test/script/plugin +3 -0
- data/test/script/runner +3 -0
- data/test/script/server +3 -0
- data/test/test/fixtures/articles.yml +13 -0
- data/test/test/functional/articles_controller_test.rb +97 -0
- data/test/test/functional/mailers_controller_test.rb +54 -0
- data/test/test/functional/users_controller_test.rb +47 -0
- data/test/test/performance/browsing_test.rb +9 -0
- data/test/test/result/en/change_title_error_messages_for.html +89 -0
- data/test/test/result/en/create_error.html +97 -0
- data/test/test/result/en/custom_error_message.html +84 -0
- data/test/test/result/en/custom_error_message_with_plural.html +84 -0
- data/test/test/result/en/distance_of_time_in_words.html +32 -0
- data/test/test/result/en/list.html +62 -0
- data/test/test/result/en/multi_error_messages_for.html +155 -0
- data/test/test/result/en/multipart.html +175 -0
- data/test/test/result/en/new.html +97 -0
- data/test/test/result/en/show.html +33 -0
- data/test/test/result/en/singlepart.html +10 -0
- data/test/test/result/fr/custom_error_message.html +84 -0
- data/test/test/result/fr/custom_error_message_with_plural.html +84 -0
- data/test/test/result/fr/distance_of_time_in_words.html +32 -0
- data/test/test/result/fr/list.html +17 -0
- data/test/test/result/fr/multipart.html +175 -0
- data/test/test/result/fr/new.html +25 -0
- data/test/test/result/fr/singlepart.html +10 -0
- data/test/test/result/ja/change_title_error_messages_for.html +89 -0
- data/test/test/result/ja/create_error.html +97 -0
- data/test/test/result/ja/custom_error_message.html +84 -0
- data/test/test/result/ja/custom_error_message_with_plural.html +84 -0
- data/test/test/result/ja/distance_of_time_in_words.html +32 -0
- data/test/test/result/ja/list.html +62 -0
- data/test/test/result/ja/multi_error_messages_for.html +155 -0
- data/test/test/result/ja/multipart.html +175 -0
- data/test/test/result/ja/new.html +97 -0
- data/test/test/result/ja/show.html +33 -0
- data/test/test/result/ja/singlepart.html +10 -0
- data/test/test/test_helper.rb +83 -0
- data/test/test/unit/article_test.rb +8 -0
- data/test/test/unit/helpers/articles_helper_test.rb +4 -0
- metadata +754 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
=begin
|
2
|
+
gettext_rails/action_mailer.rb - GetText for ActionMailer.
|
3
|
+
|
4
|
+
Copyright (C) 2005-2009 Masao Mutoh
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
|
9
|
+
Original: gettext/lib/rails.rb from Ruby-GetText-Package-1.93.0
|
10
|
+
|
11
|
+
$Id$
|
12
|
+
=end
|
13
|
+
|
14
|
+
if defined? ActionMailer
|
15
|
+
module ActionMailer #:nodoc:
|
16
|
+
class Base #:nodoc:
|
17
|
+
include GetText
|
18
|
+
|
19
|
+
def base64(text, charset="iso-2022-jp", convert=true)
|
20
|
+
if convert
|
21
|
+
if charset == "iso-2022-jp"
|
22
|
+
text = NKF.nkf('-j -m0', text)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
text = TMail::Base64.folding_encode(text)
|
26
|
+
"=?#{charset}?B?#{text}?="
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_with_gettext!(*arg) #:nodoc:
|
30
|
+
create_bang_without_gettext(*arg)
|
31
|
+
if Locale.get.language == "ja"
|
32
|
+
require 'nkf'
|
33
|
+
@mail.subject = base64(@mail.subject)
|
34
|
+
part = @mail.parts.empty? ? @mail : @mail.parts.first
|
35
|
+
if part.content_type == 'text/plain'
|
36
|
+
part.charset = 'iso-2022-jp'
|
37
|
+
part.body = NKF.nkf('-j', part.body)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@mail
|
41
|
+
end
|
42
|
+
alias_method_chain :create!, :gettext
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
=begin
|
2
|
+
gettext_rails/action_view.rb- GetText for ActionView.
|
3
|
+
|
4
|
+
Copyright (C) 2009 Masao Mutoh
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
|
9
|
+
Original: gettext/lib/rails.rb from Ruby-GetText-Package-1.93.0
|
10
|
+
|
11
|
+
$Id$
|
12
|
+
=end
|
13
|
+
|
14
|
+
require 'gettext_rails/action_view/active_record_helper'
|
15
|
+
require 'gettext_rails/action_view/date_helper'
|
16
|
+
require 'gettext_rails/action_view/form_builder'
|
@@ -0,0 +1,109 @@
|
|
1
|
+
=begin
|
2
|
+
gettext_rails/action_view/active_record_helper.rb- GetText for ActionView.
|
3
|
+
|
4
|
+
Copyright (C) 2005-2009 Masao Mutoh
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
|
9
|
+
Original: gettext/lib/rails.rb from Ruby-GetText-Package-1.93.0
|
10
|
+
|
11
|
+
$Id$
|
12
|
+
=end
|
13
|
+
|
14
|
+
module ActionView #:nodoc:
|
15
|
+
module Helpers #:nodoc:
|
16
|
+
module ActiveRecordHelper #:nodoc: all
|
17
|
+
module L10n
|
18
|
+
# Separate namespace for textdomain
|
19
|
+
include GetText
|
20
|
+
|
21
|
+
bindtextdomain "gettext_rails"
|
22
|
+
|
23
|
+
@@error_message_headers ={
|
24
|
+
:header => Nn_("%{num} error prohibited this %{record} from being saved",
|
25
|
+
"%{num} errors prohibited this %{record} from being saved"),
|
26
|
+
:body => Nn_("There was a problem with the following field:",
|
27
|
+
"There were problems with the following fields:")
|
28
|
+
}
|
29
|
+
|
30
|
+
module_function
|
31
|
+
# call-seq:
|
32
|
+
# set_error_message_title(msgs)
|
33
|
+
#
|
34
|
+
# Sets a your own title of error message dialog.
|
35
|
+
# * msgs: [single_msg, plural_msg]. Usually you need to call this with Nn_().
|
36
|
+
# * Returns: [single_msg, plural_msg]
|
37
|
+
def set_error_message_title(msg, plural_msg = nil)
|
38
|
+
if msg.kind_of? Array
|
39
|
+
single_msg = msg[0]
|
40
|
+
plural_msg = msg[1]
|
41
|
+
else
|
42
|
+
single_msg = msg
|
43
|
+
end
|
44
|
+
@@error_message_headers[:header] = [single_msg, plural_msg]
|
45
|
+
end
|
46
|
+
|
47
|
+
# call-seq:
|
48
|
+
# set_error_message_explanation(msg)
|
49
|
+
#
|
50
|
+
# Sets a your own explanation of the error message dialog.
|
51
|
+
# * msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
|
52
|
+
# * Returns: [single_msg, plural_msg]
|
53
|
+
def set_error_message_explanation(msg, plural_msg = nil)
|
54
|
+
if msg.kind_of? Array
|
55
|
+
single_msg = msg[0]
|
56
|
+
plural_msg = msg[1]
|
57
|
+
else
|
58
|
+
single_msg = msg
|
59
|
+
end
|
60
|
+
@@error_message_headers[:body] = [single_msg, plural_msg]
|
61
|
+
end
|
62
|
+
|
63
|
+
def error_message(key, model, count) #:nodoc:
|
64
|
+
return nil if key.nil?
|
65
|
+
|
66
|
+
if key.kind_of? Symbol
|
67
|
+
msgids = @@error_message_headers[key]
|
68
|
+
else
|
69
|
+
msgids = key
|
70
|
+
end
|
71
|
+
|
72
|
+
model = _(model)
|
73
|
+
if msgids
|
74
|
+
ngettext(msgids, count) % {:num => count, :count => count,
|
75
|
+
:record => model, :model => model} # :num, :record are for backward compatibility.
|
76
|
+
else
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
def error_messages_for_with_gettext_rails(*params) #:nodoc:
|
83
|
+
models = params.select{|param| ! param.kind_of? Hash}
|
84
|
+
options = params.extract_options!.symbolize_keys
|
85
|
+
|
86
|
+
header_message = options[:header_message] || options[:message_title] || :header
|
87
|
+
message = options[:message] || options[:message_explanation] || :body
|
88
|
+
|
89
|
+
object = options.delete(:object)
|
90
|
+
if object
|
91
|
+
objects = [object].flatten
|
92
|
+
else
|
93
|
+
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
|
94
|
+
end
|
95
|
+
count = objects.inject(0) {|sum, object| sum + object.errors.count }
|
96
|
+
|
97
|
+
options[:object_name] ||= params.first
|
98
|
+
normalized_model = options[:object_name].to_s.gsub('_', ' ')
|
99
|
+
|
100
|
+
options[:header_message] = L10n.error_message(header_message, normalized_model, count)
|
101
|
+
options[:message] = L10n.error_message(message, normalized_model, count)
|
102
|
+
|
103
|
+
new_params = models << options
|
104
|
+
error_messages_for_without_gettext_rails(*new_params)
|
105
|
+
end
|
106
|
+
alias_method_chain :error_messages_for, :gettext_rails
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
=begin
|
2
|
+
gettext_rails/action_view/date_helper.rb - GetText for ActionView.
|
3
|
+
|
4
|
+
Copyright (C) 2005-2009 Masao Mutoh
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
|
9
|
+
Original: gettext/lib/rails.rb from Ruby-GetText-Package-1.93.0
|
10
|
+
|
11
|
+
$Id$
|
12
|
+
=end
|
13
|
+
|
14
|
+
module ActionView #:nodoc:
|
15
|
+
module Helpers #:nodoc:
|
16
|
+
|
17
|
+
module DateHelper #:nodoc: all
|
18
|
+
include GetText
|
19
|
+
bindtextdomain "rails"
|
20
|
+
|
21
|
+
alias distance_of_time_in_words_without_locale distance_of_time_in_words #:nodoc:
|
22
|
+
|
23
|
+
# This is FAKE constant. The messages are found by rgettext as the msgid.
|
24
|
+
MESSAGESS = [N_('less than 5 seconds'), N_('less than 10 seconds'), N_('less than 20 seconds'),
|
25
|
+
N_('half a minute'), N_('less than a minute'), N_('about 1 month'),
|
26
|
+
N_('about 1 year')]
|
27
|
+
NMINUTES = [/^(\d+) minutes?$/, Nn_('1 minute', '%{num} minutes')]
|
28
|
+
NHOURS = [/^about (\d+) hours?$/, Nn_('about 1 hour', 'about %{num} hours')]
|
29
|
+
NDAYS = [/^(\d+) days?$/, Nn_('1 day', '%{num} days')]
|
30
|
+
NMONTHS = [/^(\d+) months?$/, Nn_('1 month', '%{num} months')]
|
31
|
+
NYEARS = [/^over (\d+) years?$/, Nn_('over 1 year', 'over %{num} years')]
|
32
|
+
|
33
|
+
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
|
34
|
+
msg = distance_of_time_in_words_without_locale(from_time, to_time, include_seconds)
|
35
|
+
match = false
|
36
|
+
[NMINUTES, NHOURS, NDAYS, NMONTHS, NYEARS].each do |regexp, nn|
|
37
|
+
if regexp =~ msg
|
38
|
+
match = true
|
39
|
+
msg = n_(nn, $1.to_i) % {:num => $1}
|
40
|
+
break
|
41
|
+
end
|
42
|
+
end
|
43
|
+
match ? msg : _(msg)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
=begin
|
2
|
+
gettext_rails/action_view/form_builder.rb - GetText for ActionView.
|
3
|
+
|
4
|
+
Copyright (C) 2009 Masao Mutoh
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
|
9
|
+
Original: gettext/lib/rails.rb from Ruby-GetText-Package-1.93.0
|
10
|
+
|
11
|
+
$Id$
|
12
|
+
=end
|
13
|
+
|
14
|
+
module ActionView #:nodoc:
|
15
|
+
module Helpers #:nodoc:
|
16
|
+
class FormBuilder
|
17
|
+
include GetText
|
18
|
+
|
19
|
+
def label_with_gettext(method, text = nil, options = {})
|
20
|
+
text ||= s_("#{@object.class}|#{method.to_s.humanize}")
|
21
|
+
@template.label(@object_name, method, text, options.merge(:object => @object))
|
22
|
+
end
|
23
|
+
alias_method_chain :label, :gettext
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
=begin
|
2
|
+
tools.rb - Utility functions
|
3
|
+
|
4
|
+
Copyright (C) 2009 Masao Mutoh
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'gettext_activerecord/tools'
|
11
|
+
|
12
|
+
module GetText
|
13
|
+
extend self
|
14
|
+
|
15
|
+
alias :create_mofiles_org :create_mofiles
|
16
|
+
|
17
|
+
def create_mofiles(options = {})
|
18
|
+
opts = {:verbose => true, :mo_root => "./locale"}
|
19
|
+
create_mofiles_org(opts)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#! /usr/bin/ruby
|
2
|
+
=begin
|
3
|
+
version - version information of Ruby-GetText-Package
|
4
|
+
|
5
|
+
Copyright (C) 2005-2008 Masao Mutoh
|
6
|
+
|
7
|
+
You may redistribute it and/or modify it under the same
|
8
|
+
license terms as Ruby.
|
9
|
+
=end
|
10
|
+
|
11
|
+
module GetTextRails
|
12
|
+
RAILS_VERSION = "2.3.2"
|
13
|
+
VERSION = "2.0.0"
|
14
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#
|
2
|
+
# a po-file for Ruby-GetText-Package and Ruby on Rails.
|
3
|
+
#
|
4
|
+
# Copyright (C) 2005,2006 Masao Mutoh
|
5
|
+
# This file is distributed under the same license as the Ruby-GetText-Package.
|
6
|
+
#
|
7
|
+
# Georgi Stoimenov <georgistoimenov@abv.bg>, 2008
|
8
|
+
#
|
9
|
+
msgid ""
|
10
|
+
msgstr ""
|
11
|
+
"Project-Id-Version: gettext_rails 1.93.0\n"
|
12
|
+
"POT-Creation-Date: 2009-02-20 20:21+0900\n"
|
13
|
+
"PO-Revision-Date: 2008-07-11 11:35+0300\n"
|
14
|
+
"Last-Translator: Sava Chankov <sava.chankov@gmail.com>\n"
|
15
|
+
"Language-Team: Bulgarian <ruby-on-rails-bulgaria@googlegroups.com>\n"
|
16
|
+
"MIME-Version: 1.0\n"
|
17
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
19
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
20
|
+
|
21
|
+
#: lib/gettext_rails/action_view/active_record_helper.rb:23
|
22
|
+
msgid "%{num} error prohibited this %{record} from being saved"
|
23
|
+
msgid_plural "%{num} errors prohibited this %{record} from being saved"
|
24
|
+
msgstr[0] "Поради %{num} грешка %{record} не беше записан"
|
25
|
+
msgstr[1] "Поради %{num} грешки %{record} не беше записан"
|
26
|
+
|
27
|
+
#: lib/gettext_rails/action_view/active_record_helper.rb:25
|
28
|
+
msgid "There was a problem with the following field:"
|
29
|
+
msgid_plural "There were problems with the following fields:"
|
30
|
+
msgstr[0] "Проблемът се дължи на:"
|
31
|
+
msgstr[1] "Проблемите се дължат на:"
|
32
|
+
|
33
|
+
#: lib/gettext_rails/action_view/date_helper.rb:24
|
34
|
+
msgid "less than 5 seconds"
|
35
|
+
msgstr "по-малко от 5 секунди"
|
36
|
+
|
37
|
+
#: lib/gettext_rails/action_view/date_helper.rb:24
|
38
|
+
msgid "less than 10 seconds"
|
39
|
+
msgstr "по-малко от 10 секунди"
|
40
|
+
|
41
|
+
#: lib/gettext_rails/action_view/date_helper.rb:24
|
42
|
+
msgid "less than 20 seconds"
|
43
|
+
msgstr "по-малко от 20 секунди"
|
44
|
+
|
45
|
+
#: lib/gettext_rails/action_view/date_helper.rb:25
|
46
|
+
msgid "half a minute"
|
47
|
+
msgstr "половин минута"
|
48
|
+
|
49
|
+
#: lib/gettext_rails/action_view/date_helper.rb:25
|
50
|
+
msgid "less than a minute"
|
51
|
+
msgstr "по-малко от минута"
|
52
|
+
|
53
|
+
#: lib/gettext_rails/action_view/date_helper.rb:25
|
54
|
+
msgid "about 1 month"
|
55
|
+
msgstr "около 1 месец"
|
56
|
+
|
57
|
+
#: lib/gettext_rails/action_view/date_helper.rb:26
|
58
|
+
msgid "about 1 year"
|
59
|
+
msgstr "около 1 година"
|
60
|
+
|
61
|
+
#: lib/gettext_rails/action_view/date_helper.rb:27
|
62
|
+
msgid "1 minute"
|
63
|
+
msgid_plural "%{num} minutes"
|
64
|
+
msgstr[0] "1 минута"
|
65
|
+
msgstr[1] "%{num} минути"
|
66
|
+
|
67
|
+
#: lib/gettext_rails/action_view/date_helper.rb:28
|
68
|
+
msgid "about 1 hour"
|
69
|
+
msgid_plural "about %{num} hours"
|
70
|
+
msgstr[0] "около час"
|
71
|
+
msgstr[1] "около %{num} часа"
|
72
|
+
|
73
|
+
#: lib/gettext_rails/action_view/date_helper.rb:29
|
74
|
+
msgid "1 day"
|
75
|
+
msgid_plural "%{num} days"
|
76
|
+
msgstr[0] "1 ден"
|
77
|
+
msgstr[1] "%{num} дни"
|
78
|
+
|
79
|
+
#: lib/gettext_rails/action_view/date_helper.rb:30
|
80
|
+
msgid "1 month"
|
81
|
+
msgid_plural "%{num} months"
|
82
|
+
msgstr[0] "1 месец"
|
83
|
+
msgstr[1] "%{num} месеци"
|
84
|
+
|
85
|
+
#: lib/gettext_rails/action_view/date_helper.rb:31
|
86
|
+
msgid "over 1 year"
|
87
|
+
msgid_plural "over %{num} years"
|
88
|
+
msgstr[0] "повече от година"
|
89
|
+
msgstr[1] "повече %{num} години"
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# translation of rails.po to Bosnian
|
2
|
+
#
|
3
|
+
# a po-file for Ruby-GetText-Package and Ruby on Rails.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2005-2007 Masao Mutoh
|
6
|
+
#
|
7
|
+
# This file is distributed under the same license as the Ruby-GetText-Package.
|
8
|
+
#
|
9
|
+
# Sanjin Sehic <saserr at gmail.com>, 2007.
|
10
|
+
msgid ""
|
11
|
+
msgstr ""
|
12
|
+
"Project-Id-Version: gettext_rails 1.93.0\n"
|
13
|
+
"POT-Creation-Date: 2009-02-20 20:21+0900\n"
|
14
|
+
"PO-Revision-Date: 2007-06-26 19:02+0200\n"
|
15
|
+
"Last-Translator: Sanjin Sehic <saserr at gmail.com>\n"
|
16
|
+
"Language-Team: Bosnian <saserr at gmail.com>\n"
|
17
|
+
"MIME-Version: 1.0\n"
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
19
|
+
"Content-Transfer-Encoding: 8bit\n"
|
20
|
+
"Plural-Forms: n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n"
|
21
|
+
"%100>=20) ? 1 : 2;\n"
|
22
|
+
"X-Generator: KBabel 1.11.4\n"
|
23
|
+
|
24
|
+
#: lib/gettext_rails/action_view/active_record_helper.rb:23
|
25
|
+
msgid "%{num} error prohibited this %{record} from being saved"
|
26
|
+
msgid_plural "%{num} errors prohibited this %{record} from being saved"
|
27
|
+
msgstr[0] "%{num} greška je spriječila %{record} od spašavanja"
|
28
|
+
msgstr[1] "%{num} greške su spriječile %{record} od spašavanja"
|
29
|
+
msgstr[2] "%{num} grešaka su spriječile %{record} od spašavanja"
|
30
|
+
|
31
|
+
#: lib/gettext_rails/action_view/active_record_helper.rb:25
|
32
|
+
msgid "There was a problem with the following field:"
|
33
|
+
msgid_plural "There were problems with the following fields:"
|
34
|
+
msgstr[0] "Postoji problem u sljedečem polju:"
|
35
|
+
msgstr[1] "Postoje problemi u sljedečim poljima:"
|
36
|
+
msgstr[2] "Postoje problemi u sljedečim poljima:"
|
37
|
+
|
38
|
+
#: lib/gettext_rails/action_view/date_helper.rb:24
|
39
|
+
msgid "less than 5 seconds"
|
40
|
+
msgstr "manje od 5 sekundi"
|
41
|
+
|
42
|
+
#: lib/gettext_rails/action_view/date_helper.rb:24
|
43
|
+
msgid "less than 10 seconds"
|
44
|
+
msgstr "manje od 10 sekundi"
|
45
|
+
|
46
|
+
#: lib/gettext_rails/action_view/date_helper.rb:24
|
47
|
+
msgid "less than 20 seconds"
|
48
|
+
msgstr "manje od 20 sekundi"
|
49
|
+
|
50
|
+
#: lib/gettext_rails/action_view/date_helper.rb:25
|
51
|
+
msgid "half a minute"
|
52
|
+
msgstr "pola minute"
|
53
|
+
|
54
|
+
#: lib/gettext_rails/action_view/date_helper.rb:25
|
55
|
+
msgid "less than a minute"
|
56
|
+
msgstr "manje od minute"
|
57
|
+
|
58
|
+
#: lib/gettext_rails/action_view/date_helper.rb:25
|
59
|
+
msgid "about 1 month"
|
60
|
+
msgstr "oko 1 mjesec"
|
61
|
+
|
62
|
+
#: lib/gettext_rails/action_view/date_helper.rb:26
|
63
|
+
msgid "about 1 year"
|
64
|
+
msgstr "oko godinu dana"
|
65
|
+
|
66
|
+
#: lib/gettext_rails/action_view/date_helper.rb:27
|
67
|
+
msgid "1 minute"
|
68
|
+
msgid_plural "%{num} minutes"
|
69
|
+
msgstr[0] "1 minuta"
|
70
|
+
msgstr[1] "%{num} minute"
|
71
|
+
msgstr[2] "%{num} minuta"
|
72
|
+
|
73
|
+
#: lib/gettext_rails/action_view/date_helper.rb:28
|
74
|
+
msgid "about 1 hour"
|
75
|
+
msgid_plural "about %{num} hours"
|
76
|
+
msgstr[0] "oko 1 sat"
|
77
|
+
msgstr[1] "oko %{num} sata"
|
78
|
+
msgstr[2] "oko %{num} sati"
|
79
|
+
|
80
|
+
#: lib/gettext_rails/action_view/date_helper.rb:29
|
81
|
+
msgid "1 day"
|
82
|
+
msgid_plural "%{num} days"
|
83
|
+
msgstr[0] "1 dan"
|
84
|
+
msgstr[1] "%{num} dana"
|
85
|
+
msgstr[2] "%{num} dana"
|
86
|
+
|
87
|
+
#: lib/gettext_rails/action_view/date_helper.rb:30
|
88
|
+
msgid "1 month"
|
89
|
+
msgid_plural "%{num} months"
|
90
|
+
msgstr[0] "1 mjesec"
|
91
|
+
msgstr[1] "%{num} mjeseca"
|
92
|
+
msgstr[2] "%{num} mjeseci"
|
93
|
+
|
94
|
+
#: lib/gettext_rails/action_view/date_helper.rb:31
|
95
|
+
msgid "over 1 year"
|
96
|
+
msgid_plural "over %{num} years"
|
97
|
+
msgstr[0] "preko 1 godine"
|
98
|
+
msgstr[1] "preko %{num} godine"
|