Hi,
I have created an initializer like this :
module Hobo
module Helper
def base_url_for(object, subsite, action)
path = object.to_url_path or Hobo::Error.new("cannot create url for
#{object.inspect} (#{object.class})")
"#{base_url}#{'/' + locale.to_s unless locale.blank?}#{'/' + subsite
unless subsite.blank?}/#{path}"
end
end
end
This redefine base_url_for so that I have the locale in first place of the
url, after base_url.
I'm not sure it's the best way to do, but it works well.
Regards,
Arnaud.
2011/6/2 Arnaud D. <[email protected]>
> Hi everyone,
>
> I would like to internationalize my hobo app but I encounter a problem.
> The configuration should be like this :
> Url to use
> localhost:3000/:locale/...
>
> In the I18n rails guide, it's said to add in application_controller:
> def default_url_options(options={})
> { :locale => I18n.locale }
> end
>
> And in routes.rb :
> scope "/:locale", :locale => /en|fr/ do
> ...
> end
>
> So that all urls generated by url_for or link_to are internationalized with
> the locale in the first "subdir" of the url.
>
> But, with hobo, this won't work.
> Any use of <a> tag doesn't create the url like this.
> Furthermore, the hobo_routes cannot be configured to be in this scope
> either.
>
> I tried to extend tag "a" like this :
> <extend tag="a">
> <old-a params="&{'locale' => I18n.locale}" merge/>
> </extend>
>
> And this doesn't give what I want.
> I only have the locale has parameter in the url (i.e. ?locale=en)
> And the nav_items become broken. (I see label : <Not available>)
>
> How should I do to make this works like in the standard rails guide ?
>
> Thanks for any hint about that,
> Arnaud.
>
--
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.