gettext_rails 2.0.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/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
data/COPYING
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
You can redistribute this program and/or modify it under either the terms of
|
|
2
|
+
the LGPL (see the file LGPL), or the conditions below:
|
|
3
|
+
|
|
4
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
5
|
+
software without restriction, provided that you duplicate all of the
|
|
6
|
+
original copyright notices and associated disclaimers.
|
|
7
|
+
|
|
8
|
+
2. You may modify your copy of the software in any way, provided that
|
|
9
|
+
you do at least ONE of the following:
|
|
10
|
+
|
|
11
|
+
a) place your modifications in the Public Domain or otherwise
|
|
12
|
+
make them Freely Available, such as by posting said
|
|
13
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
14
|
+
the author to include your modifications in the software.
|
|
15
|
+
|
|
16
|
+
b) use the modified software only within your corporation or
|
|
17
|
+
organization.
|
|
18
|
+
|
|
19
|
+
c) rename any non-standard executables so the names do not conflict
|
|
20
|
+
with standard executables, which must also be provided.
|
|
21
|
+
|
|
22
|
+
d) make other distribution arrangements with the author.
|
|
23
|
+
|
|
24
|
+
3. You may distribute the software in object code or executable
|
|
25
|
+
form, provided that you do at least ONE of the following:
|
|
26
|
+
|
|
27
|
+
a) distribute the executables and library files of the software,
|
|
28
|
+
together with instructions (in the manual page or equivalent)
|
|
29
|
+
on where to get the original distribution.
|
|
30
|
+
|
|
31
|
+
b) accompany the distribution with the machine-readable source of
|
|
32
|
+
the software.
|
|
33
|
+
|
|
34
|
+
c) give non-standard executables non-standard names, with
|
|
35
|
+
instructions on where to get the original software distribution.
|
|
36
|
+
|
|
37
|
+
d) make other distribution arrangements with the author.
|
|
38
|
+
|
|
39
|
+
4. You may modify and include the part of the software into any other
|
|
40
|
+
software (possibly commercial). But some files in the distribution
|
|
41
|
+
are not written by the author, so that they are not under these terms.
|
|
42
|
+
|
|
43
|
+
For the list of those files and their copying conditions, see the
|
|
44
|
+
file LEGAL.
|
|
45
|
+
|
|
46
|
+
5. The scripts and library files supplied as input to or produced as
|
|
47
|
+
output from the software do not automatically fall under the
|
|
48
|
+
copyright of the software, but belong to whomever generated them,
|
|
49
|
+
and may be sold commercially, and may be aggregated with this
|
|
50
|
+
software.
|
|
51
|
+
|
|
52
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
53
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
54
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
55
|
+
PURPOSE.
|
data/ChangeLog
ADDED
data/README.rdoc
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
= gettext_rails
|
|
2
|
+
|
|
3
|
+
gettext_rails provides the localization for Ruby on Rails-2.3 or later
|
|
4
|
+
using Ruby-GetText-Package.
|
|
5
|
+
|
|
6
|
+
* Autodetect client locale using locale/locale_rails.
|
|
7
|
+
* Easy maintainance of translations to use powerful tools for gettext family.
|
|
8
|
+
* Model translation using gettext_activerecord.
|
|
9
|
+
* Localization for some helpers.
|
|
10
|
+
* Works with other Rails I18n backend.
|
|
11
|
+
* Note that gettext_rails is not the one of I18n backend.
|
|
12
|
+
* Thread safe.
|
|
13
|
+
|
|
14
|
+
== Website
|
|
15
|
+
* homepage[http://www.yotabanana.com/hiki/ruby-gettext.html]
|
|
16
|
+
* on rubyforge[http://gettext/rubyforge.org/]
|
|
17
|
+
* on github[http://github.com/mutoh/gettext_rails/tree/master]
|
|
18
|
+
|
|
19
|
+
== Requirements
|
|
20
|
+
* {Ruby 1.8.3 or later}[http://www.ruby-lang.org]
|
|
21
|
+
* {Rubygems}[http://www.rubygems.org/]
|
|
22
|
+
* {locale gem}[http://rubyforge.org/projects/locale/]
|
|
23
|
+
* {locale_rails gem}[http://rubyforge.org/projects/locale_rails/]
|
|
24
|
+
* {gettext gem}[http://rubyforge.org/projects/gettext/]
|
|
25
|
+
* {gettext_activerecord gem}[http://rubyforge.org/projects/gettext/]
|
|
26
|
+
* {gettext_rails gem}[http://rubyforge.org/projects/gettext/]
|
|
27
|
+
|
|
28
|
+
== Install
|
|
29
|
+
#Uninstall old gettext if exists.
|
|
30
|
+
(sudo/su on POSIX system)
|
|
31
|
+
gem uninstall gettext
|
|
32
|
+
|
|
33
|
+
#from github (edge/unstable)
|
|
34
|
+
(sudo/su on POSIX system)
|
|
35
|
+
gem install gettext
|
|
36
|
+
gem install gettext_activerecord
|
|
37
|
+
gem install gettext_rails
|
|
38
|
+
gem install mutoh-gettext_rails -s http://gems.github.com/
|
|
39
|
+
|
|
40
|
+
#from rubyforge (stable)
|
|
41
|
+
(sudo/su on POSIX system)
|
|
42
|
+
gem install gettext
|
|
43
|
+
gem install gettext_activerecord
|
|
44
|
+
gem install gettext_rails
|
|
45
|
+
|
|
46
|
+
== Usage
|
|
47
|
+
See sample direcotries for more details.
|
|
48
|
+
|
|
49
|
+
==== Rakefile
|
|
50
|
+
require 'rubygems'
|
|
51
|
+
|
|
52
|
+
desc "Create mo files"
|
|
53
|
+
task :makemo do
|
|
54
|
+
require 'gettext_rails/tools'
|
|
55
|
+
GetText.create_mofiles
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
task :updatepo do
|
|
59
|
+
require 'gettext_rails/tools'
|
|
60
|
+
# Need to access DB to find Model table/column names.
|
|
61
|
+
# Use config/database.yml which is the same style with rails.
|
|
62
|
+
GetText.update_pofiles("sample_rails", ["topic.rb"], "sample_rails 1.0.0")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
==== config/environment.rb
|
|
66
|
+
Rails::Initializer.run do |config|
|
|
67
|
+
:
|
|
68
|
+
:
|
|
69
|
+
config.gem "locale_rails"
|
|
70
|
+
config.gem "gettext_activerecord"
|
|
71
|
+
config.gem "gettext_rails"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
==== application_controller.rb
|
|
75
|
+
class ApplicationController < ActionController::Base
|
|
76
|
+
init_gettext "blog" # replace "blog" to your textdomain name.
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
==== Then ...
|
|
80
|
+
$ rake updatepo
|
|
81
|
+
$ cd po
|
|
82
|
+
$ mkdir ja
|
|
83
|
+
$ msginit -l ja_JP.UTF-8 -i blog.pot -o ja/sample.po
|
|
84
|
+
$ Edit ja/sample.po
|
|
85
|
+
$ cd ../../
|
|
86
|
+
$ rake makemo
|
|
87
|
+
$ ruby sample.rb
|
|
88
|
+
|
|
89
|
+
See {Ruby-GetText-Package HOWTO for Ruby on Rails}[http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html] for more details.
|
|
90
|
+
|
|
91
|
+
== Support matrix
|
|
92
|
+
* gettext_rails-2.0.0 - rails-2.3.2
|
|
93
|
+
|
|
94
|
+
== License
|
|
95
|
+
This program is licenced under the same licence as Ruby.
|
|
96
|
+
(See the file 'COPYING'.)
|
|
97
|
+
|
|
98
|
+
* Copyright (C) 2001-2009 Masao Mutoh <mutoh at highwhay.ne.jp>
|
|
99
|
+
== Translators
|
|
100
|
+
* Bosnian(bs) - Sanjin Sehic <saserr at gmail.com>
|
|
101
|
+
* Bulgarian(bg) - Sava Chankov <sava.chankov at gmail.com>
|
|
102
|
+
* Catalan(ca) - Ramon Salvadó <rsalvado at gnuine.com>
|
|
103
|
+
* Chinese(Simplified)(zh_CN)
|
|
104
|
+
* Yang Bob <bob.yang.dev at gmail.com> (current)
|
|
105
|
+
* Yingfeng <blogyingfeng at gmail.com>
|
|
106
|
+
* Chinese(Traditional)(zh_TW)
|
|
107
|
+
* Yang Bob <bob.yang.dev at gmail.com> (current)
|
|
108
|
+
* LIN CHUNG-YI <xmarsh at gmail.com>
|
|
109
|
+
* Croatian(hr) - Sanjin Sehic <saserr at gmail.com>
|
|
110
|
+
* Czech(cs) - Karel Miarka <kajism at yahoo.com>
|
|
111
|
+
* Dutch(nl) - Menno Jonkers <ruby-gettext at jonkers.com>
|
|
112
|
+
* Esperanto(eo) - Malte Milatz <malte at gmx-topmail.de>
|
|
113
|
+
* Estonian(et) - Erkki Eilonen <erkki at itech.ee>
|
|
114
|
+
* French(fr)
|
|
115
|
+
* Vincent Isambart <vincent.isambart at gmail.com> (current)
|
|
116
|
+
* David Sulc <davidsulc at gmail.com>
|
|
117
|
+
* David Sulc <davidsulc at gmail.com>
|
|
118
|
+
* Laurent Sansonetti <laurent.sansonetti at gmail.com>
|
|
119
|
+
* German(de)
|
|
120
|
+
* Patrick Lenz <patrick at limited-overload.de> (current)
|
|
121
|
+
* Detlef Reichl <detlef.reichl at gmx.org>
|
|
122
|
+
* Sven Herzberg <herzi at abi02.de>
|
|
123
|
+
* Sascha Ebach <se at digitale-wertschoepfung.de>
|
|
124
|
+
* Greek(el) - Vassilis Rizopoulos <damphyr at gmx.net>
|
|
125
|
+
* Hungarian(hu) - Tamás Tompa <tompata at gmail.com>
|
|
126
|
+
* Italian(it)
|
|
127
|
+
* Marco Lazzeri <marco.lazzeri at gmail.com>
|
|
128
|
+
* Gabriele Renzi <surrender_it at yahoo.it>
|
|
129
|
+
* Japanese(ja) - Masao Mutoh <mutomasa at gmail.com>
|
|
130
|
+
* Korean(ko) - Gyoung-Yoon Noh <nohmad at gmail.com>
|
|
131
|
+
* Latvian(lv) - Aivars Akots <aivars.akots at gmail.com>
|
|
132
|
+
* Norwegian(nb) - Runar Ingebrigtsen <runar at mopo.no>
|
|
133
|
+
* Portuguese(Brazil)(pt_BR)
|
|
134
|
+
* Antonio S. de A. Terceiro <terceiro at softwarelivre.org> (current)
|
|
135
|
+
* Joao Pedrosa <joaopedrosa at gmail.com>
|
|
136
|
+
* Russian(ru) - Yuri Kozlov <kozlov.y at gmail.com>
|
|
137
|
+
* Serbian(sr) - Slobodan Paunović" <slobodan.paunovic at gmail.com>
|
|
138
|
+
* Spanish(es)
|
|
139
|
+
* David Espada <davinci at escomposlinux.org> (current)
|
|
140
|
+
* David Moreno Garza <damog at damog.net>
|
|
141
|
+
* Ukrainian(ua) - Alex Rootoff <rootoff at pisem.net>
|
|
142
|
+
* Vietnamese(vi) - Ngoc Dao Thanh <ngocdaothanh at gmail.com>
|
|
143
|
+
|
|
144
|
+
== Status of translations
|
|
145
|
+
* Bosnian(bs) - 1.90.0 (old)
|
|
146
|
+
* Bulgarian(bg) - 2.0.0
|
|
147
|
+
* Catalan(ca) - 2.0.0
|
|
148
|
+
* Croatian(hr) - 1.90.0 (old)
|
|
149
|
+
* Chinese(zh_CN) - 2.0.0
|
|
150
|
+
* Chinese(zh_TW) - 2.0.0
|
|
151
|
+
* Czech(cs) - 1.9.0 (old)
|
|
152
|
+
* Dutch(nl) - 1.90.0 (old)
|
|
153
|
+
* English(default) - 1.90.0 (old)
|
|
154
|
+
* Esperanto(eo) - 2.0.0
|
|
155
|
+
* Estonian(et) - 2.0.0
|
|
156
|
+
* French(fr) - 2.0.0
|
|
157
|
+
* German(de) - 2.0.0
|
|
158
|
+
* Greek(el) - 2.0.0
|
|
159
|
+
* Hungarian(hu) - 2.0.0
|
|
160
|
+
* Italian(it) - 1.6.0 (old)
|
|
161
|
+
* Japanese(ja) - 2.0.0
|
|
162
|
+
* Korean(ko) - 1.9.0 (old)
|
|
163
|
+
* Latvian(lv) - 2.0.0
|
|
164
|
+
* Norwegian(nb) - 2.0.0
|
|
165
|
+
* Portuguese(Brazil)(pt_BR) - 2.0.0
|
|
166
|
+
* Russian(ru) - 2.0.0
|
|
167
|
+
* Serbian(sr) - 1.91.0 (old)
|
|
168
|
+
* Spanish(es) - 2.0.0
|
|
169
|
+
* Ukrainian(ua) - 2.0.0
|
|
170
|
+
* Vietnamese(vi) - 2.0.0
|
|
171
|
+
|
|
172
|
+
== Maintainer
|
|
173
|
+
Masao Mutoh <mutomasa at gmail.com>
|
data/Rakefile
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Rakefile for gettext_rails.
|
|
3
|
+
#
|
|
4
|
+
# Use setup.rb or gem for installation.
|
|
5
|
+
# You don't need to use this file directly.
|
|
6
|
+
#
|
|
7
|
+
# Copyright(c) 2009 Masao Mutoh
|
|
8
|
+
#
|
|
9
|
+
# This program is licenced under the same licence as Ruby.
|
|
10
|
+
#
|
|
11
|
+
|
|
12
|
+
#make lib and paralel gettext checkout available
|
|
13
|
+
$LOAD_PATH.unshift "./lib"
|
|
14
|
+
gettext_path = File.join(ENV["GETTEXT_PATH"] || "../gettext/", "lib")
|
|
15
|
+
$LOAD_PATH.unshift gettext_path
|
|
16
|
+
|
|
17
|
+
require 'rubygems'
|
|
18
|
+
require 'rake'
|
|
19
|
+
require 'rake/packagetask'
|
|
20
|
+
require 'rake/gempackagetask'
|
|
21
|
+
require 'rake/rdoctask'
|
|
22
|
+
|
|
23
|
+
gettext_path = File.join(ENV["GETTEXT_PATH"] || "../gettext/", "lib")
|
|
24
|
+
$LOAD_PATH.unshift gettext_path
|
|
25
|
+
|
|
26
|
+
require 'gettext_rails/version'
|
|
27
|
+
|
|
28
|
+
PKG_VERSION = GetTextRails::VERSION
|
|
29
|
+
|
|
30
|
+
task :default => [:makemo]
|
|
31
|
+
|
|
32
|
+
############################################################
|
|
33
|
+
# Manage po/mo files
|
|
34
|
+
############################################################
|
|
35
|
+
desc "Create *.mo from *.po"
|
|
36
|
+
task :makemo do
|
|
37
|
+
$stderr.puts "Create active_record mo files."
|
|
38
|
+
require 'gettext/tools'
|
|
39
|
+
GetText.create_mofiles
|
|
40
|
+
|
|
41
|
+
$stderr.puts "Create sample mo files."
|
|
42
|
+
GetText.create_mofiles(:po_root => "sample/po",
|
|
43
|
+
:mo_root => "sample/locale")
|
|
44
|
+
|
|
45
|
+
$stderr.puts "Create samples/rails plugin mo files."
|
|
46
|
+
GetText.create_mofiles(:po_root => "sample/vendor/plugins/lang_helper/po",
|
|
47
|
+
:mo_root => "sample/vendor/plugins/lang_helper/locale")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc "Update pot/po files to match new version."
|
|
51
|
+
task :updatepo do
|
|
52
|
+
require 'gettext/tools'
|
|
53
|
+
|
|
54
|
+
GetText.update_pofiles("gettext_rails",
|
|
55
|
+
Dir.glob("lib/**/*.rb"),
|
|
56
|
+
"gettext_rails #{PKG_VERSION}")
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
############################################################
|
|
61
|
+
# Package tasks
|
|
62
|
+
############################################################
|
|
63
|
+
|
|
64
|
+
desc "Create gem and tar.gz"
|
|
65
|
+
spec = Gem::Specification.new do |s|
|
|
66
|
+
s.name = 'gettext_rails'
|
|
67
|
+
s.version = PKG_VERSION
|
|
68
|
+
s.summary = 'Localization support for Ruby on Rails(>=2.3) by Ruby-GetText-Package.'
|
|
69
|
+
s.author = 'Masao Mutoh'
|
|
70
|
+
s.email = 'mutomasa at gmail.com'
|
|
71
|
+
s.homepage = 'http://gettext.rubyforge.org/'
|
|
72
|
+
s.rubyforge_project = "gettext"
|
|
73
|
+
s.files = FileList['**/*'].to_a.select{|v| v !~ /pkg|git/}
|
|
74
|
+
s.add_dependency('gettext_activerecord', '>= 2.0.0')
|
|
75
|
+
s.add_dependency('locale_rails', '>= 2.0.0')
|
|
76
|
+
s.add_dependency('rails', '>= 2.3.2')
|
|
77
|
+
s.require_path = 'lib'
|
|
78
|
+
s.has_rdoc = true
|
|
79
|
+
s.description = 'Localization support for Ruby on Rails(>=2.3.2) by Ruby-GetText-Package.'
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
Rake::GemPackageTask.new(spec) do |p|
|
|
83
|
+
p.gem_spec = spec
|
|
84
|
+
p.need_tar_gz = false
|
|
85
|
+
p.need_zip = false
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
############################################################
|
|
89
|
+
# Misc tasks
|
|
90
|
+
############################################################
|
|
91
|
+
|
|
92
|
+
Rake::RDocTask.new { |rdoc|
|
|
93
|
+
allison = `allison --path`.chop
|
|
94
|
+
rdoc.rdoc_dir = 'doc'
|
|
95
|
+
rdoc.title = "gettext_rails API Reference"
|
|
96
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
|
97
|
+
rdoc.rdoc_files.include('README', 'ChangeLog')
|
|
98
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
99
|
+
rdoc.template = allison if allison.size > 0
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
desc "Publish the release files to RubyForge."
|
|
103
|
+
task :release => [ :package ] do
|
|
104
|
+
require 'rubyforge'
|
|
105
|
+
|
|
106
|
+
rubyforge = RubyForge.new
|
|
107
|
+
rubyforge.configure
|
|
108
|
+
rubyforge.login
|
|
109
|
+
rubyforge.add_release("gettext", "gettext_rails",
|
|
110
|
+
PKG_VERSION,
|
|
111
|
+
"pkg/gettext_rails-#{PKG_VERSION}.gem")
|
|
112
|
+
end
|
|
113
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
gettext_rails.rb- GetText for "Ruby on Rails"
|
|
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
|
+
require 'gettext_rails/action_controller.rb'
|
|
15
|
+
require 'gettext_rails/action_view.rb'
|
|
16
|
+
require 'gettext_rails/action_mailer.rb'
|
|
17
|
+
require 'gettext_rails/version.rb'
|
|
18
|
+
|
|
19
|
+
begin
|
|
20
|
+
Rails::Info.property("GetText version") do
|
|
21
|
+
GetText::VERSION
|
|
22
|
+
end
|
|
23
|
+
Rails::Info.property("GetText for Rails version") do
|
|
24
|
+
GetTextRails::VERSION
|
|
25
|
+
end
|
|
26
|
+
rescue Exception
|
|
27
|
+
$stderr.puts "GetText's Rails::Info is not found." if $DEBUG
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
if ::RAILS_ENV == "development"
|
|
31
|
+
GetText::TextDomainManager.cached = false
|
|
32
|
+
end
|
|
33
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
gettext_rails/action_controller.rb - GetText for ActionController.
|
|
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
|
+
require 'gettext/cgi'
|
|
14
|
+
require 'locale_rails'
|
|
15
|
+
require 'action_controller'
|
|
16
|
+
|
|
17
|
+
module ActionController #:nodoc:
|
|
18
|
+
class Base
|
|
19
|
+
include GetText
|
|
20
|
+
|
|
21
|
+
# Append a block which is called before initializing gettext on the each WWW request.
|
|
22
|
+
#
|
|
23
|
+
# (e.g.)
|
|
24
|
+
# class ApplicationController < ActionController::Base
|
|
25
|
+
# before_init_gettext{|controller|
|
|
26
|
+
# cookies = controller.cookies
|
|
27
|
+
# if (cookies["lang"].nil? or cookies["lang"].empty?)
|
|
28
|
+
# GetText.locale = "zh_CN"
|
|
29
|
+
# else
|
|
30
|
+
# GetText.locale = cookies["lang"]
|
|
31
|
+
# end
|
|
32
|
+
# }
|
|
33
|
+
# init_gettext "myapp"
|
|
34
|
+
# # ...
|
|
35
|
+
# end
|
|
36
|
+
def self.before_init_gettext(*filters, &block)
|
|
37
|
+
before_init_locale(*filters, &block)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Append a block which is called after initializing gettext on the each WWW request.
|
|
41
|
+
#
|
|
42
|
+
# The GetText.locale is set the locale which bound to the textdomains
|
|
43
|
+
# when gettext is initialized.
|
|
44
|
+
#
|
|
45
|
+
# (e.g.)
|
|
46
|
+
# class ApplicationController < ActionController::Base
|
|
47
|
+
# after_init_gettext {|controller|
|
|
48
|
+
# L10nClass.new(GetText.locale)
|
|
49
|
+
# }
|
|
50
|
+
# init_gettext "foo"
|
|
51
|
+
# # ...
|
|
52
|
+
# end
|
|
53
|
+
def self.after_init_gettext(*filters, &block)
|
|
54
|
+
after_init_locale(*filters, &block)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Bind a 'textdomain' to all of the controllers/views/models. Call this instead of GetText.bindtextdomain.
|
|
58
|
+
# * textdomain: the textdomain
|
|
59
|
+
# * options: options as a Hash.
|
|
60
|
+
# * :charset - the output charset. Default is "UTF-8"
|
|
61
|
+
# * :locale_path - the path to locale directory. Default is {RAILS_ROOT}/locale or {plugin root directory}/locale.
|
|
62
|
+
#
|
|
63
|
+
# locale is searched the order by params["lang"] > "lang" value of QUERY_STRING >
|
|
64
|
+
# "lang" value of Cookie > HTTP_ACCEPT_LANGUAGE value > Default locale(en).
|
|
65
|
+
# And the charset is set order by "the argument of bindtextdomain" > HTTP_ACCEPT_CHARSET > Default charset(UTF-8).
|
|
66
|
+
# Refer Ruby-Locale for more details.
|
|
67
|
+
#
|
|
68
|
+
# If you want to separate the textdomain each controllers, you need to call this function in the each controllers.
|
|
69
|
+
#
|
|
70
|
+
# app/controller/blog_controller.rb:
|
|
71
|
+
# class BlogController < ApplicationController
|
|
72
|
+
# init_gettext "blog"
|
|
73
|
+
# :
|
|
74
|
+
# end
|
|
75
|
+
def self.init_gettext(domainname, options = {})
|
|
76
|
+
opt = {:charset => "UTF-8"}.merge(options)
|
|
77
|
+
|
|
78
|
+
set_output_charset(opt[:charset])
|
|
79
|
+
locale_path = opt[:locale_path]
|
|
80
|
+
unless locale_path
|
|
81
|
+
cal = caller[0]
|
|
82
|
+
if cal =~ /app.controllers/
|
|
83
|
+
# Don't use RAILS_ROOT first, for RailsEngines.
|
|
84
|
+
locale_path = File.join(cal.split(/app.controllers/)[0] + "locale")
|
|
85
|
+
else
|
|
86
|
+
locale_path = File.join(RAILS_ROOT, "locale")
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
bindtextdomain(domainname, {:path => locale_path})
|
|
91
|
+
|
|
92
|
+
if defined? ActiveRecord::Base
|
|
93
|
+
textdomain_to(ActiveRecord::Base, domainname)
|
|
94
|
+
textdomain_to(ActiveRecord::Validations, domainname)
|
|
95
|
+
end
|
|
96
|
+
textdomain_to(ActionView::Base, domainname) if defined? ActionView::Base
|
|
97
|
+
textdomain_to(ApplicationHelper, domainname) if defined? ApplicationHelper
|
|
98
|
+
textdomain_to(ActionMailer::Base, domainname) if defined? ActionMailer::Base
|
|
99
|
+
textdomain_to(ActionView::Helpers, domainname) if defined? ActionView::Helpers
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|