Hi Guillaume,
Thanks for your quick reply, I was travelling back from Thanksgiving
and am just getting back to emails.
I am using Rails 2.3.2 and I installed the plugin (as opposed to the
gem) to avoid the I18n gem issue.
rake routes shows the translated routes
zh_cn_view_product /:productname/網
店/:id
{:controller=>"products", :action=>"view_product"}
view_product /:productname/
stores/:id
{:controller=>"products", :action=>"view_product"}
And console data shows how the named path is working but url_for is
not
ruby-1.8.6-p420 > symbolhash = {}
=> {}
ruby-1.8.6-p420 > {"action"=>"view_product", "id"=>"7",
"controller"=>"products", "productname"=>"panduit-10-14-ring-terminal-
rohs"}.each { |k,v| symbolhash[k.intern] = v}
=> {"action"=>"view_product", "id"=>"7", "controller"=>"products",
"productname"=>"panduit-10-14-ring-terminal-rohs"}
ruby-1.8.6-p420 > app.url_for(symbolhash)
=> "
http://www.example.com/panduit-10-14-ring-terminal-rohs/stores/
7"
ruby-1.8.6-p420 > app.view_product_path(symbolhash)
=> "/panduit-10-14-ring-terminal-rohs/stores/7"
ruby-1.8.6-p420 > I18n.locale
=> :en
ruby-1.8.6-p420 > I18n.locale = :zh_cn
=> :zh_cn
ruby-1.8.6-p420 > app.url_for(symbolhash)
=> "
http://www.example.com/panduit-10-14-ring-terminal-rohs/stores/
7"
ruby-1.8.6-p420 > app.view_product_path(symbolhash)
=> "/panduit-10-14-ring-terminal-rohs/網店/7"
It's very bizarre. Is there an option or argument I can pass to
url_for to force it to use the translated route? Thanks for your help!
Richard
On Nov 29, 5:45 pm, Guillaume Luccisano
<
guillaume.luccis...@gmail.com> wrote:
> Hi Richard,
>
> Yes, it should work, that's the purpose of the gem :)
> Which version of Rails are you using ?
> You can print your routes with rake routes to see if you routes are
> correctly translated.
>
> Thanks
>
> 2010/11/29 richard <
ran1347...@gmail.com>