depending on your app I might suggest having it be a user preference
thing (as in store it on the user model).  That what I've done with
one app for localized times.

On Sep 23, 2:21 pm, charlesdeb <[email protected]> wrote:
> I have managed to get locale files working fine with hobo for several
> languages which seems to be what most people are asking in this group.
> my question is probably a little more basic.
>
> I am trying to figure how to change the locale (using a drop down
> select box) and keep that information between page refreshes. i have
> tried to follow the rails i18n tutorial here (http://
> guides.rubyonrails.org/i18n.html) but have run into the following
> errors when trying to put locale info into each request as a
> parameter:
>
> 1) after updating the default_url_options in application_controller
> (as suggested in the rails guide) to this:
>
> def default_url_options(options={})
>   logger.debug "default_url_options is passed options:
> #{options.inspect}\n"
>   { :locale => I18n.locale }
> end
>
> the <dev-user-changer> tag appears to be broken. It stuffs locale
> information into the generated URLs wrongly. Here is an example of a
> URL it creates:
>
> http://localhost:3000/dev?locale=en/set_current_user?login=someone%40...
>
> this URL (unsurprisingly) just takes me to a blank page. my guess is
> that the URL should be more like:
>
> http://localhost:3000/dev/set_current_user?login=someone%40yahoo.co.u...
>
> with the locale at the end of the string. is this a bug or am i doing
> something stupid?
>
> 2) again, according to the rails document, this same piece of code for
> default_url_options should add locale as a parameter to every URL in
> the app. generated by the url_for helper. Well, it doesn't in my
> application.
>
> A DRYML like:
>
>   <nav-item with="&Album"><ht key="navigation.music">music</ht></nav-
> item>
>
> creates a completely normal link with no locale info in it, even when
> the locale has been changed.
>
> 3) To avoid having '&local=tr' or such like in each request string, I
> tried changing my routes.rb file to include the "scope" command
> (again, as per the i18n guide) using something similar to:
>
> scope "/:locale" do
>   resources :album
> end
>
> i tried putting just this in my routes file, and then i tried putting
> all of the routes within the scope do block. rails just tells me:
>
> Internal Server Error
> undefined method `scope' for main:Object
>
> when i click on any link in my application. It seems like 'scope' is
> an unknown keyword in the routes.rb file.
>
> I am using rails 2.3.8, hobo 1.0.1 and i18n 0.4.1. This must be
> something pretty basic. Any suggestions?
>
> charles, charles

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to