Hi there, I'm implementing the Globalize plugin on my application, and so far it's working quite well. One problem I'm having is that I can't do any functional tests. It appears as though the locale is not set for the tests, and an error is thrown by the find_every function where it tries to get the language code. This problem is not seen outside of testing. is this common? Can anyone else reproduce it? Is there a fix? I'm using Rails 1.1 and the 1.1 branch of Globalize. Also the include_translated option for the find method doesn't appear to work. Is there some trick to use it? It always throws an invalid option error. Regards, Bonne Eggeleston.
on 2006-08-04 11:38
on 2006-08-07 02:11
I am having about the same issue. I'm using Globalize with a switch in the url like ":locale/:controller/..." and it breaks functional tests, spitting out "No url can be generated for the hash"-routing errors. I've tried to get around this by setting up a redirect. This would even come in handy for other reasons. What I tried to achieve is that urls without the locale like "www.url.com/mycontroller/" would get redirected to "www.url.com/en/mycontroller/", with "en" here being the default locale. Does anyone know how to get this done? Greetings Patrick
on 2006-12-08 20:42
Bonne Eggleston wrote: > Hi there, > I'm implementing the Globalize plugin on my application, and so far it's > working quite well. > One problem I'm having is that I can't do any functional tests. > It appears as though the locale is not set for the tests. Having the same problem. I've had to comment out all my functional tests for the moment because of locale not being set. Anyone know of a solution?
on 2006-12-09 18:33
Posted about it here also: http://www.bitbutter.com/5/globalize-did-localebase_language-eat-my-functional-tests/
on 2006-12-12 15:21
Bitbutter wrote: > Posted about it here also: > http://www.bitbutter.com/5/globalize-did-localebase_language-eat-my-functional-tests/ I'm experiencing the same problem, but since I've just started learning Rails, I can't seem to fix it. Does anyone have a solution yet?
on 2006-12-12 16:06
On Dec 12, 2006, at 15:21, KJ Wierenga wrote: > Bitbutter wrote: >> Posted about it here also: >> http://www.bitbutter.com/5/globalize-did-localebase_language-eat- >> my-functional-tests/ > > I'm experiencing the same problem, but since I've just started > learning > Rails, I can't seem to fix it. Does anyone have a solution yet? try this: Loading test environment. >> Locale => Globalize::Locale >> Locale.set_base_language Language.pick('en') => English >> Locale.base_language => English >> Locale.set_base_language Language.pick('de') => German >> Locale.base_language => German
on 2006-12-12 16:23
Benjamin Krause wrote: > try this: > > Loading test environment. > >> Locale > => Globalize::Locale > >> Locale.set_base_language Language.pick('en') > => English > >> Locale.base_language > => English > >> Locale.set_base_language Language.pick('de') > => German > >> Locale.base_language > => German Odd, i get an error when i try that: Loading test environment. >> Locale => Globalize::Locale >> Locale.set_base_language Language.pick('en') ArgumentError: bad format for , not rfc-3066 compliant from ./script/../config/../config/../vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb:6:in `parse' from ./script/../config/../config/../vendor/plugins/globalize/lib/globalize/localization/locale.rb:64:in `set_base_language' from (irb):2 >> (rails 1.1.6.5618)
on 2006-12-12 16:34
When I use Locale.set_base_language Language.pick('en') function I get:
/vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb:6:in
`parse': bad format for , not rfc-3066 compliant (ArgumentError)
on 2006-12-12 16:36
KJ Wierenga wrote: > When I use Locale.set_base_language Language.pick('en') function I get: > > /vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb:6:in > `parse': bad format for , not rfc-3066 compliant (ArgumentError) So same error as Bitbutter. I'm using Rails 1.1.6 on Windows
on 2006-12-12 16:39
I managed to get rid of the 'base_language' not set error by having the
following code in my ApplicationController:
class ApplicationController < ActionController::Base
model :cart
model :line_item
before_filter :set_locale
after_filter :set_charset
def set_locale
if !params[:locale].nil? && LOCALES.keys.include?(params[:locale])
Locale.set LOCALES[params[:locale]]
else
if Locale.base_language
redirect_to params.merge( 'locale' => Locale.base_language.code
)
else
redirect_to params.merge( 'locale' => 'en' )
end
return true
end
end
...
end
But now I get:
Exception: Render and/or redirect were called multiple times in this
action. Please note that you may only call render OR redirect, and only
once per action. Also note that neither redirect nor render terminate
execution of the action, so if you want to exit an action after
redirecting, you need to do something like "redirect_to(...) and
return". Finally, note that to cause a before filter to halt execution
of the rest of the filter chain, the filter must return false,
explicitly, so "render(...) and return false".
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:840:in
`redirect_to'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:854:in
`redirect_to'
D:/Projects/Rails/depot/config/../app/controllers/application.rb:43:in
`authorize'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:399:in
`send'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:399:in
`call_filters'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:394:in
`each'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:394:in
`call_filters'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:383:in
`before_action'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:365:in
`perform_action_without_benchmark'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
`perform_action'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
`send'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
`process_without_filters'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
`process_without_test'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/test_process.rb:16:in
`process'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/test_process.rb:363:in
`process'
d:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/test_process.rb:336:in
`get'
D:\Projects\Rails\depot/test/functional/login_controller_test.rb:17:in
`test_index'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testcase.rb:72:in
`__send__'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testcase.rb:72:in
`run'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in
`run'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in
`each'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in
`run'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in
`run'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in
`each'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in
`run'
d:/Tools/InstantRails/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
`run_suite'
D:/Tools/RadRails_0_7_2/plugins/org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/RemoteTestRunner.rb:107:in
`start_mediator'
D:/Tools/RadRails_0_7_2/plugins/org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/RemoteTestRunner.rb:52:in
`start'
D:/Tools/RadRails_0_7_2/plugins/org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/RemoteTestRunner.rb:272
on 2006-12-12 17:11
(KJ Wierenga: i initially tried a set up like the one you posted but also ran into similar recursion difficulties. If you like you can mail me at kj.1.cbit AT spamgourmet.com and i'll send you some examples of the sessions based approach i'm using now)
on 2006-12-12 18:24
Perhaps you meant to return false in a filter chain after a redirect? http://weblog.jamisbuck.org/2005/7/8/rails-tip-of-the-day FYI: be careful with the set_charset action: http://www.nabble.com/FIXED-Internet-Explorer-cannot-download-pages-tf2716459s17045.html On 12/12/06, Bitbutter <rf.10.cbit@spamgourmet.com> wrote: > http://rubyforge.org/mailman/listinfo/railsi18n-discussion > -- Charles Brian Quinn self-promotion: www.seebq.com highgroove studios: www.highgroove.com slingshot hosting: www.slingshothosting.com
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.