activeldap 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +24 -0
- data/README +9 -3
- data/Rakefile +24 -50
- data/examples/al-admin/Rakefile +6 -0
- data/examples/al-admin/app/controllers/application_controller.rb +9 -2
- data/examples/al-admin/config/environment.rb +9 -3
- data/examples/al-admin/config/initializers/fast_gettext.rb +3 -0
- data/examples/al-admin/config/session_secret.txt +1 -1
- data/lib/active_ldap.rb +6 -19
- data/lib/active_ldap/adapter/base.rb +22 -20
- data/lib/active_ldap/adapter/jndi.rb +2 -3
- data/lib/active_ldap/adapter/jndi_connection.rb +2 -2
- data/lib/active_ldap/adapter/ldap.rb +9 -4
- data/lib/active_ldap/adapter/net_ldap.rb +5 -4
- data/lib/active_ldap/base.rb +1 -1
- data/lib/active_ldap/get_text.rb +2 -2
- data/lib/active_ldap/get_text_fallback.rb +39 -32
- data/lib/active_ldap/get_text_support.rb +4 -2
- data/lib/active_ldap/operations.rb +3 -2
- data/lib/active_ldap/validations.rb +11 -21
- data/po/en/active-ldap.po +9 -9
- data/po/ja/active-ldap.po +18 -18
- data/test/run-test.rb +7 -1
- data/test/test_adapter.rb +1 -0
- data/test/test_base.rb +8 -1
- data/test/test_load.rb +2 -1
- data/test/test_user.rb +3 -4
- data/test/test_validation.rb +20 -23
- metadata +34 -228
- data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
- data/examples/al-admin/config/initializers/gettext.rb +0 -1
- data/examples/al-admin/lib/tasks/gettext.rake +0 -36
- data/examples/al-admin/locale/en/LC_MESSAGES/al-admin.mo +0 -0
- data/examples/al-admin/locale/ja/LC_MESSAGES/al-admin.mo +0 -0
- data/examples/al-admin/locale/nl/LC_MESSAGES/al-admin.mo +0 -0
- data/examples/al-admin/po/al-admin.pot +0 -344
- data/examples/al-admin/public/images/active-ldap.png +0 -0
- data/examples/al-admin/vendor/locale_rails/.gitignore +0 -6
- data/examples/al-admin/vendor/locale_rails/COPYING +0 -56
- data/examples/al-admin/vendor/locale_rails/ChangeLog +0 -35
- data/examples/al-admin/vendor/locale_rails/README.rdoc +0 -62
- data/examples/al-admin/vendor/locale_rails/Rakefile +0 -73
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails.rb +0 -18
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller.rb +0 -15
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/base.rb +0 -82
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/caching.rb +0 -51
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/test_process.rb +0 -44
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_view.rb +0 -53
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/i18n.rb +0 -67
- data/examples/al-admin/vendor/locale_rails/lib/locale_rails/version.rb +0 -4
- data/examples/al-admin/vendor/locale_rails/sample/README +0 -22
- data/examples/al-admin/vendor/locale_rails/sample/Rakefile +0 -10
- data/examples/al-admin/vendor/locale_rails/sample/app/controllers/application.rb +0 -42
- data/examples/al-admin/vendor/locale_rails/sample/app/controllers/samples_controller.rb +0 -30
- data/examples/al-admin/vendor/locale_rails/sample/app/helpers/application_helper.rb +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/app/views/layouts/samples.html.erb +0 -20
- data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part.html.erb +0 -68
- data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part_nl.html.erb +0 -2
- data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/cached_action.html.erb +0 -6
- data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.html.erb +0 -33
- data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.pt.html.erb +0 -16
- data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index_uz_UZ.html.erb +0 -16
- data/examples/al-admin/vendor/locale_rails/sample/config/boot.rb +0 -109
- data/examples/al-admin/vendor/locale_rails/sample/config/environment.rb +0 -25
- data/examples/al-admin/vendor/locale_rails/sample/config/environments/development.rb +0 -17
- data/examples/al-admin/vendor/locale_rails/sample/config/environments/production.rb +0 -24
- data/examples/al-admin/vendor/locale_rails/sample/config/environments/test.rb +0 -22
- data/examples/al-admin/vendor/locale_rails/sample/config/initializers/inflections.rb +0 -10
- data/examples/al-admin/vendor/locale_rails/sample/config/initializers/mime_types.rb +0 -5
- data/examples/al-admin/vendor/locale_rails/sample/config/initializers/new_rails_defaults.rb +0 -17
- data/examples/al-admin/vendor/locale_rails/sample/config/locales/en.yml +0 -2
- data/examples/al-admin/vendor/locale_rails/sample/config/locales/ja.yml +0 -2
- data/examples/al-admin/vendor/locale_rails/sample/config/routes.rb +0 -13
- data/examples/al-admin/vendor/locale_rails/sample/db/schema.rb +0 -10
- data/examples/al-admin/vendor/locale_rails/sample/public/404.html +0 -30
- data/examples/al-admin/vendor/locale_rails/sample/public/422.html +0 -30
- data/examples/al-admin/vendor/locale_rails/sample/public/500.html +0 -33
- data/examples/al-admin/vendor/locale_rails/sample/public/dispatch.cgi +0 -10
- data/examples/al-admin/vendor/locale_rails/sample/public/dispatch.fcgi +0 -24
- data/examples/al-admin/vendor/locale_rails/sample/public/dispatch.rb +0 -10
- data/examples/al-admin/vendor/locale_rails/sample/public/favicon.ico +0 -0
- data/examples/al-admin/vendor/locale_rails/sample/public/images/rails.png +0 -0
- data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/application.js +0 -2
- data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/controls.js +0 -963
- data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/dragdrop.js +0 -972
- data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/effects.js +0 -1120
- data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/prototype.js +0 -4221
- data/examples/al-admin/vendor/locale_rails/sample/public/robots.txt +0 -5
- data/examples/al-admin/vendor/locale_rails/sample/public/stylesheets/locale.css +0 -81
- data/examples/al-admin/vendor/locale_rails/sample/public/stylesheets/scaffold.css +0 -74
- data/examples/al-admin/vendor/locale_rails/sample/script/about +0 -4
- data/examples/al-admin/vendor/locale_rails/sample/script/console +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/dbconsole +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/destroy +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/generate +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/performance/benchmarker +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/performance/profiler +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/performance/request +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/plugin +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/process/inspector +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/process/reaper +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/process/spawner +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/runner +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/script/server +0 -3
- data/examples/al-admin/vendor/locale_rails/sample/test/performance/browsing_test.rb +0 -9
- data/examples/al-admin/vendor/locale_rails/sample/test/test_helper.rb +0 -38
- data/examples/al-admin/vendor/locale_rails/test/README +0 -243
- data/examples/al-admin/vendor/locale_rails/test/Rakefile +0 -10
- data/examples/al-admin/vendor/locale_rails/test/app/controllers/application_controller.rb +0 -10
- data/examples/al-admin/vendor/locale_rails/test/app/controllers/articles_controller.rb +0 -17
- data/examples/al-admin/vendor/locale_rails/test/app/helpers/application_helper.rb +0 -3
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index.html.erb +0 -1
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_de.html.erb +0 -1
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_fr_FR.html.erb +0 -1
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_ja.html.erb +0 -1
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/list.html.erb +0 -1
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/show.html.erb +0 -0
- data/examples/al-admin/vendor/locale_rails/test/app/views/articles/show.js.rjs +0 -0
- data/examples/al-admin/vendor/locale_rails/test/config/boot.rb +0 -110
- data/examples/al-admin/vendor/locale_rails/test/config/environment.rb +0 -42
- data/examples/al-admin/vendor/locale_rails/test/config/environments/development.rb +0 -17
- data/examples/al-admin/vendor/locale_rails/test/config/environments/production.rb +0 -28
- data/examples/al-admin/vendor/locale_rails/test/config/environments/test.rb +0 -35
- data/examples/al-admin/vendor/locale_rails/test/config/initializers/backtrace_silencers.rb +0 -7
- data/examples/al-admin/vendor/locale_rails/test/config/initializers/inflections.rb +0 -10
- data/examples/al-admin/vendor/locale_rails/test/config/initializers/mime_types.rb +0 -5
- data/examples/al-admin/vendor/locale_rails/test/config/initializers/new_rails_defaults.rb +0 -19
- data/examples/al-admin/vendor/locale_rails/test/config/initializers/session_store.rb +0 -15
- data/examples/al-admin/vendor/locale_rails/test/config/locales/en.yml +0 -5
- data/examples/al-admin/vendor/locale_rails/test/config/routes.rb +0 -46
- data/examples/al-admin/vendor/locale_rails/test/db/schema.rb +0 -0
- data/examples/al-admin/vendor/locale_rails/test/public/404.html +0 -30
- data/examples/al-admin/vendor/locale_rails/test/public/422.html +0 -30
- data/examples/al-admin/vendor/locale_rails/test/public/500.html +0 -30
- data/examples/al-admin/vendor/locale_rails/test/public/favicon.ico +0 -0
- data/examples/al-admin/vendor/locale_rails/test/public/images/rails.png +0 -0
- data/examples/al-admin/vendor/locale_rails/test/public/index.html +0 -275
- data/examples/al-admin/vendor/locale_rails/test/public/javascripts/application.js +0 -2
- data/examples/al-admin/vendor/locale_rails/test/public/javascripts/controls.js +0 -963
- data/examples/al-admin/vendor/locale_rails/test/public/javascripts/dragdrop.js +0 -973
- data/examples/al-admin/vendor/locale_rails/test/public/javascripts/effects.js +0 -1128
- data/examples/al-admin/vendor/locale_rails/test/public/javascripts/prototype.js +0 -4320
- data/examples/al-admin/vendor/locale_rails/test/public/robots.txt +0 -5
- data/examples/al-admin/vendor/locale_rails/test/script/about +0 -4
- data/examples/al-admin/vendor/locale_rails/test/script/console +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/dbconsole +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/destroy +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/generate +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/performance/benchmarker +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/performance/profiler +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/plugin +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/runner +0 -3
- data/examples/al-admin/vendor/locale_rails/test/script/server +0 -3
- data/examples/al-admin/vendor/locale_rails/test/test/functional/articles_controller_test.rb +0 -161
- data/examples/al-admin/vendor/locale_rails/test/test/performance/browsing_test.rb +0 -9
- data/examples/al-admin/vendor/locale_rails/test/test/test_helper.rb +0 -38
- data/po/active-ldap.pot +0 -4010
- data/test-unit/COPYING +0 -56
- data/test-unit/GPL +0 -340
- data/test-unit/History.txt +0 -223
- data/test-unit/Manifest.txt +0 -87
- data/test-unit/PSFL +0 -271
- data/test-unit/README.txt +0 -60
- data/test-unit/Rakefile +0 -40
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/images/color-diff.png +0 -0
- data/test-unit/lib/test/unit.rb +0 -328
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
- data/test-unit/lib/test/unit/assertions.rb +0 -1334
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -360
- data/test-unit/lib/test/unit/collector.rb +0 -36
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -144
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -106
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -740
- data/test-unit/lib/test/unit/error.rb +0 -130
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -136
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -129
- data/test-unit/lib/test/unit/omission.rb +0 -191
- data/test-unit/lib/test/unit/pending.rb +0 -150
- data/test-unit/lib/test/unit/priority.rb +0 -180
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -478
- data/test-unit/lib/test/unit/testresult.rb +0 -89
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -466
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -42
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/output.rb +0 -31
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/test_adder.rb +0 -20
- data/test-unit/sample/test_subtracter.rb +0 -20
- data/test-unit/sample/test_user.rb +0 -23
- data/test-unit/test/collector/test-descendant.rb +0 -133
- data/test-unit/test/collector/test-load.rb +0 -442
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -100
- data/test-unit/test/run-test.rb +0 -15
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -69
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -518
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -544
- data/test-unit/test/test_assertions.rb +0 -1197
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test-output.rb +0 -11
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
@@ -1,22 +0,0 @@
|
|
1
|
-
== Ruby-Locale for Ruby on Rails sample application
|
2
|
-
This is the sample application for localization.
|
3
|
-
|
4
|
-
=== Includes
|
5
|
-
1. How to get current language.
|
6
|
-
2. Auto-Detect the locale from the WWW browser
|
7
|
-
3. Set locale as the "lang" parameter
|
8
|
-
4. Set "lang" as the cookie value
|
9
|
-
5. Localized Routes
|
10
|
-
6. Action caching
|
11
|
-
7. Separate Localized View template file
|
12
|
-
|
13
|
-
== Installation
|
14
|
-
|
15
|
-
1. Instal rails-2.2.x.
|
16
|
-
2. Install sqlite3-ruby
|
17
|
-
gem install sqlite3-ruby
|
18
|
-
3. Install locale_rails
|
19
|
-
gem install locale_rails
|
20
|
-
4. rake db:create
|
21
|
-
5. ruby script/server
|
22
|
-
6. Access http://localhost:3000/ from the WWW browser.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
-
|
6
|
-
require 'rake'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'rake/rdoctask'
|
9
|
-
|
10
|
-
require 'tasks/rails'
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Filters added to this controller apply to all controllers in the application.
|
2
|
-
# Likewise, all the methods added will be available for all controllers.
|
3
|
-
|
4
|
-
class ApplicationController < ActionController::Base
|
5
|
-
helper :all # include all helpers, all the time
|
6
|
-
|
7
|
-
# See ActionController::RequestForgeryProtection for details
|
8
|
-
# Uncomment the :secret if you're not using the cookie session store
|
9
|
-
protect_from_forgery # :secret => '639df270d82028344f5a50f543530c57'
|
10
|
-
|
11
|
-
# See ActionController::Base for details
|
12
|
-
# Uncomment this to filter the contents of submitted sensitive data parameters
|
13
|
-
# from your application log (in this case, all fields with names like "password").
|
14
|
-
# filter_parameter_logging :password
|
15
|
-
|
16
|
-
# Set the charset of Content-Type.
|
17
|
-
# This is not Ruby-Locale method but useful.
|
18
|
-
# self.default_charset = "iso8859-1"
|
19
|
-
# I18n.supported_locales = ["en", "ja", "fr"]
|
20
|
-
|
21
|
-
=begin
|
22
|
-
def before_init_i18n
|
23
|
-
# Initialize other i18n libraries before init_locale if you need.
|
24
|
-
# Or set "lang" to it's own value before initializing Locale.
|
25
|
-
if (cookies["lang"].nil? or cookies["lang"].empty?)
|
26
|
-
params["lang"] = "ko_KR"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
before_init_locale :before_init_i18n
|
30
|
-
|
31
|
-
def after_init_i18n
|
32
|
-
# Initialize other i18n libraries after init_locale if you need.
|
33
|
-
#
|
34
|
-
# LocalizeFoo.locale = Locale.current
|
35
|
-
# I18n.locale is set in init_locale, but other I18n features
|
36
|
-
# is not set by Ruby-Locale. So you may need to add the code to work your
|
37
|
-
# Rails i18n plugins.
|
38
|
-
end
|
39
|
-
after_init_locale :after_init_i18n
|
40
|
-
=end
|
41
|
-
|
42
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class SamplesController < ApplicationController
|
2
|
-
caches_action :cached_action
|
3
|
-
|
4
|
-
def index
|
5
|
-
end
|
6
|
-
|
7
|
-
def set_cookie
|
8
|
-
flash[:notice] = "Cookie lang value is: " + params[:id]
|
9
|
-
|
10
|
-
cookies["lang"] = params[:id]
|
11
|
-
|
12
|
-
respond_to do |format|
|
13
|
-
format.html { redirect_to :action => "index" }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def clear_cookie
|
18
|
-
cookies["lang"] = nil
|
19
|
-
|
20
|
-
flash[:notice] = "Cookie lang value is cleared. "
|
21
|
-
respond_to do |format|
|
22
|
-
format.html { redirect_to :action => "index" }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def cached_action
|
27
|
-
p "cached_action. This is shown first time only."
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= Locale.current.to_rfc %>" lang="<%= Locale.current.to_rfc %>">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="content-type" content="text/html;charset=<%= Locale.charset %>" />
|
7
|
-
<title>Ruby-Locale Sample on Ruby on Rails: <%= controller.action_name %></title>
|
8
|
-
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
-
<%= stylesheet_link_tag 'locale' %>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
<p style="color: red"><%= flash[:notice] %></p>
|
13
|
-
|
14
|
-
<%= yield %>
|
15
|
-
|
16
|
-
<div class="copyright">
|
17
|
-
Copyright (C) 2008 Masao Mutoh
|
18
|
-
</div>
|
19
|
-
</body>
|
20
|
-
</html>
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
app_lang_tags = ["ja_JP", "fr", "pt_BR", "zh_CN", "en_Latn_US_NYNORSK", "uz_UZ", "nl"]
|
3
|
-
%>
|
4
|
-
|
5
|
-
<h2>Get the current locale</h2>
|
6
|
-
<h3>Locale.candidates(with no option)</h3>
|
7
|
-
<p>Requested Locales order by the priority. This method is added by Ruby-Locale for Ruby on Rails.</p>
|
8
|
-
<div class="result">
|
9
|
-
<%=h Locale.candidates.inspect %>
|
10
|
-
</div>
|
11
|
-
|
12
|
-
<h3>I18n.locale (with inspect)</h3>
|
13
|
-
<p>I18n.locale is set the result(Locale::TagList) of Locale.candidates(:type => :rfc).<br/>
|
14
|
-
This method is extended by Ruby-Locale for Ruby on Rails and returns all candidates as the Locale::TagList.
|
15
|
-
</p>
|
16
|
-
<div class="result">
|
17
|
-
<%=h I18n.locale.inspect %>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<h3>I18n.locale (without inspect)</h3>
|
21
|
-
<p>Locale::TagList(the result of I18n.locale) can behave like a single tag string to follow I18n.locale specification.</p>
|
22
|
-
<div class="result">
|
23
|
-
<%=h I18n.locale %>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
<h2>Auto-Detect the locale from the WWW browser</h2>
|
27
|
-
<p><a href="<%= samples_path %>">Reload this URL</a></p>
|
28
|
-
|
29
|
-
<h2>Set locale as the "lang" parameter</h2>
|
30
|
-
|
31
|
-
<ol>
|
32
|
-
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
|
33
|
-
url = samples_path(:lang => lang) %>
|
34
|
-
<li><%= link_to h(url), url %> [<%= lang %>]</li>
|
35
|
-
<% end %>
|
36
|
-
</ol>
|
37
|
-
|
38
|
-
<h2>Set "lang" as the cookie value.</h2>
|
39
|
-
<p>Click one of the link below, and then click "Auto-Detect the locale from the WWW browser".</p>
|
40
|
-
|
41
|
-
<ol>
|
42
|
-
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
|
43
|
-
url = url_for(:controller => :samples, :action => :set_cookie, :id => lang) %>
|
44
|
-
<li><%= link_to h(url), {:action => :set_cookie, :id => lang} %> [<%= lang %>]</li>
|
45
|
-
<% end %>
|
46
|
-
<li><%= link_to "Clear cookie", :action => :clear_cookie %> </li>
|
47
|
-
</ol>
|
48
|
-
|
49
|
-
<h2>Localized Routes</h2>
|
50
|
-
<p>See config/routes.rb</p>
|
51
|
-
|
52
|
-
<ol>
|
53
|
-
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
|
54
|
-
url = url_for(:controller => :samples, :lang => lang, :action => :index) %>
|
55
|
-
<li><%= link_to h(url),:controller => :samples, :lang => lang, :action => :index %> [<%= lang %>]</li>
|
56
|
-
<% end %>
|
57
|
-
</ol>
|
58
|
-
|
59
|
-
<h2>Caching</h2>
|
60
|
-
<p>Fragment/Action caching is supported. Here is the sample for action caching. <br/>
|
61
|
-
Click the links then check %{RAILS_ROOT}/tmp/cache/ where Cached file is stored.
|
62
|
-
</p>
|
63
|
-
<ol>
|
64
|
-
<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang|
|
65
|
-
url = url_for(:controller => :samples, :action => :cached_action, :lang => lang) %>
|
66
|
-
<li><%= link_to h(url), {:controller => :samples, :action => :cached_action, :lang => lang} %> [<%= lang %>]</li>
|
67
|
-
<% end %>
|
68
|
-
</ol>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<h1>Ruby-Locale and Ruby on Rails 2.2 sample</h1>
|
2
|
-
<p><a href ="http://locale.rubyforge.org/svn/trunk/locale_rails/sample">[source code]</a></p>
|
3
|
-
|
4
|
-
<p style="color:red">This page is cached for [<%= I18n.locale %>]. <br/>
|
5
|
-
See %{RAILS_ROOT}/tmp/cache/*.</p>
|
6
|
-
<p><%= link_to "[BACK]", samples_path %></p>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<h1>Ruby-Locale and Ruby on Rails sample</h1>
|
2
|
-
<p><a href ="http://locale.rubyforge.org/svn/trunk/locale_rails/sample">[source code]</a></p>
|
3
|
-
|
4
|
-
<h2>The values from Rails</h2>
|
5
|
-
<table border="1" cellspacing="0" cellpadding="2">
|
6
|
-
<tr><th>Variables</th><th>Values</th></tr>
|
7
|
-
<tr><td>HTTP_ACCEPT_LANGUAGE</td><td> <%= request.accept_language %></td></tr>
|
8
|
-
<tr><td>HTTP_ACCEPT_CHARSET</td><td> <%= request.accept_charset %></td></tr>
|
9
|
-
<tr><td>QUERY_STRING</td><td> <%= request.query_string %></td></tr>
|
10
|
-
<tr><td>params[:lang]</td><td><%= params[:lang] %></td></tr>
|
11
|
-
<tr><td>cookies[:lang]</td><td> <%= cookies[:lang] %></td></tr>
|
12
|
-
<tr><td>I18n.t :hello (*1)</td><td> <%= I18n.t :hello %></td></tr>
|
13
|
-
</table>
|
14
|
-
<p>
|
15
|
-
(*1) Fallback to "en" if the localized message is not found in the locale.
|
16
|
-
Currently, <%= Dir.glob(File.join(RAILS_ROOT, "config/locales/*.yml")).collect {|v| File.basename(v, ".yml")}.inspect %> are available.
|
17
|
-
</p>
|
18
|
-
|
19
|
-
<%= render :partial => 'part' %>
|
20
|
-
|
21
|
-
<h2>Separate Localized View template file in each languages</h2>
|
22
|
-
<p>View template can be separeted with language tags.</p>
|
23
|
-
<ol>
|
24
|
-
<li><%= link_to "uz_UZ has special index page(index_uz_UZ.html.erb)", :controller => :samples, :action => :index, :lang => "uz_UZ" %></li>
|
25
|
-
<li><%= link_to "uz uses normal index page", :controller => :samples, :action => :index, :lang => "uz" %></li>
|
26
|
-
<li><%= link_to "nl has special _part page(_part_nl.html.erb)", :controller => :samples, :action => :index, :lang => "nl" %></li>
|
27
|
-
<li><%= link_to "nl_BE also uses the special _part page(_part_nl.html.erb)", :controller => :samples, :action => :index, :lang => "nl_BE" %></li>
|
28
|
-
</ol>
|
29
|
-
<p>View template by Rails-2.3.x is also supported. </p>
|
30
|
-
<ol>
|
31
|
-
<li><%= link_to "pt has special index page(index.pt.html.erb)", :controller => :samples, :action => :index, :lang => "pt" %></li>
|
32
|
-
<li><%= link_to "pt_BR uses normal index page", :controller => :samples, :action => :index, :lang => "pt_BR" %></li>
|
33
|
-
</ol>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<h1>Ruby-Locale and Ruby on Rails 2.2 sample</h1>
|
2
|
-
<p><a href ="http://locale.rubyforge.org/svn/trunk/locale_rails/sample">[source code]</a></p>
|
3
|
-
|
4
|
-
<h2>The values from Rails</h2>
|
5
|
-
<table border="1" cellspacing="0" cellpadding="2">
|
6
|
-
<tr><th>Variables</th><th>Values</th></tr>
|
7
|
-
<tr><td>HTTP_ACCEPT_LANGUAGE</td><td> <%= request.accept_language %></td></tr>
|
8
|
-
<tr><td>HTTP_ACCEPT_CHARSET</td><td> <%= request.accept_charset %></td></tr>
|
9
|
-
<tr><td>QUERY_STRING</td><td> <%= request.query_string %></td></tr>
|
10
|
-
<tr><td>params[:lang]</td><td><%= params[:lang] %></td></tr>
|
11
|
-
<tr><td>cookies[:lang]</td><td> <%= cookies[:lang] %></td></tr>
|
12
|
-
<tr><td>I18n.t :hello (*1)</td><td> <%= I18n.t :hello %></td></tr>
|
13
|
-
</table>
|
14
|
-
|
15
|
-
<p style="color:red">This page is for pt only. See app/views/samples/index.pt.html.erb. This format is supported by Rails-2.3.x as default.</p>
|
16
|
-
<p><%= link_to "[BACK]", samples_path %></p>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<h1>Ruby-Locale and Ruby on Rails 2.2 sample</h1>
|
2
|
-
<p><a href ="http://locale.rubyforge.org/svn/trunk/locale_rails/sample">[source code]</a></p>
|
3
|
-
|
4
|
-
<h2>The values from Rails</h2>
|
5
|
-
<table border="1" cellspacing="0" cellpadding="2">
|
6
|
-
<tr><th>Variables</th><th>Values</th></tr>
|
7
|
-
<tr><td>HTTP_ACCEPT_LANGUAGE</td><td> <%= request.accept_language %></td></tr>
|
8
|
-
<tr><td>HTTP_ACCEPT_CHARSET</td><td> <%= request.accept_charset %></td></tr>
|
9
|
-
<tr><td>QUERY_STRING</td><td> <%= request.query_string %></td></tr>
|
10
|
-
<tr><td>params[:lang]</td><td><%= params[:lang] %></td></tr>
|
11
|
-
<tr><td>cookies[:lang]</td><td> <%= cookies[:lang] %></td></tr>
|
12
|
-
<tr><td>I18n.t :hello (*1)</td><td> <%= I18n.t :hello %></td></tr>
|
13
|
-
</table>
|
14
|
-
|
15
|
-
<p style="color:red">This page is for uz_UZ only. See app/views/samples/index_uz_UZ.html.erb.</p>
|
16
|
-
<p><%= link_to "[BACK]", samples_path %></p>
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# Don't change this file!
|
2
|
-
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
-
|
4
|
-
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
-
|
6
|
-
module Rails
|
7
|
-
class << self
|
8
|
-
def boot!
|
9
|
-
unless booted?
|
10
|
-
preinitialize
|
11
|
-
pick_boot.run
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def booted?
|
16
|
-
defined? Rails::Initializer
|
17
|
-
end
|
18
|
-
|
19
|
-
def pick_boot
|
20
|
-
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
-
end
|
22
|
-
|
23
|
-
def vendor_rails?
|
24
|
-
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
-
end
|
26
|
-
|
27
|
-
def preinitialize
|
28
|
-
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def preinitializer_path
|
32
|
-
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class Boot
|
37
|
-
def run
|
38
|
-
load_initializer
|
39
|
-
Rails::Initializer.run(:set_load_path)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class VendorBoot < Boot
|
44
|
-
def load_initializer
|
45
|
-
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
-
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class GemBoot < Boot
|
51
|
-
def load_initializer
|
52
|
-
self.class.load_rubygems
|
53
|
-
load_rails_gem
|
54
|
-
require 'initializer'
|
55
|
-
end
|
56
|
-
|
57
|
-
def load_rails_gem
|
58
|
-
if version = self.class.gem_version
|
59
|
-
gem 'rails', version
|
60
|
-
else
|
61
|
-
gem 'rails'
|
62
|
-
end
|
63
|
-
rescue Gem::LoadError => load_error
|
64
|
-
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
65
|
-
exit 1
|
66
|
-
end
|
67
|
-
|
68
|
-
class << self
|
69
|
-
def rubygems_version
|
70
|
-
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
|
71
|
-
end
|
72
|
-
|
73
|
-
def gem_version
|
74
|
-
if defined? RAILS_GEM_VERSION
|
75
|
-
RAILS_GEM_VERSION
|
76
|
-
elsif ENV.include?('RAILS_GEM_VERSION')
|
77
|
-
ENV['RAILS_GEM_VERSION']
|
78
|
-
else
|
79
|
-
parse_gem_version(read_environment_rb)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def load_rubygems
|
84
|
-
require 'rubygems'
|
85
|
-
min_version = '1.1.1'
|
86
|
-
unless rubygems_version >= min_version
|
87
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
|
-
exit 1
|
89
|
-
end
|
90
|
-
|
91
|
-
rescue LoadError
|
92
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
93
|
-
exit 1
|
94
|
-
end
|
95
|
-
|
96
|
-
def parse_gem_version(text)
|
97
|
-
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
def read_environment_rb
|
102
|
-
File.read("#{RAILS_ROOT}/config/environment.rb")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# All that for this:
|
109
|
-
Rails.boot!
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file
|
2
|
-
|
3
|
-
# Uncomment below to force Rails into production mode when
|
4
|
-
# you don't control web/app server and can't set it the proper way
|
5
|
-
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
-
|
7
|
-
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
#RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
9
|
-
|
10
|
-
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
12
|
-
|
13
|
-
Rails::Initializer.run do |config|
|
14
|
-
config.time_zone = 'UTC'
|
15
|
-
|
16
|
-
config.action_controller.session = {
|
17
|
-
:session_key => '_rails_session',
|
18
|
-
:secret => '25fe1cb0e4295d9ede3b21864a1a3b589a4656bd0032fee8b8a470a93d221d4d666e9076a35bd0e4fd0fe8ca12eec9dc85f46554cd6e26b4569548b6ee03323a'
|
19
|
-
}
|
20
|
-
|
21
|
-
config.gem "locale"
|
22
|
-
config.gem "locale_rails"
|
23
|
-
end
|
24
|
-
|
25
|
-
ActionController::Base.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
-
|
3
|
-
# In the development environment your application's code is reloaded on
|
4
|
-
# every request. This slows down response time but is perfect for development
|
5
|
-
# since you don't have to restart the webserver when you make code changes.
|
6
|
-
config.cache_classes = true
|
7
|
-
|
8
|
-
# Log error messages when you accidentally call methods on nil.
|
9
|
-
config.whiny_nils = true
|
10
|
-
|
11
|
-
# Show full error reports and disable caching
|
12
|
-
config.action_controller.consider_all_requests_local = true
|
13
|
-
config.action_view.debug_rjs = true
|
14
|
-
config.action_controller.perform_caching = true
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|