url_for problems

45 views
Skip to first unread message

Davide Barison

unread,
Nov 5, 2013, 8:43:41 AM11/5/13
to i18n-r...@googlegroups.com
Hi guys the plugins works great but i have this problem with url_for method


when i do

%link{:rel => 'alternate', :hreflang => l, :href => (request.protocol + request.host_with_port + url_for(:locale => l)).html_safe}

i got

 <link href='http://127.0.0.1:3000/en/prodotti' hreflang='en' rel='alternate'>
    <link href='http://127.0.0.1:3000/ja/prodotti' hreflang='ja' rel='alternate'>


instead of

 <link href='http://127.0.0.1:3000/en/products' hreflang='en' rel='alternate'>
    <link href='http://127.0.0.1:3000/ja/製品' hreflang='ja' rel='alternate'>


I'm using rails 3.2.14

any help? this is a bug?

thx

Michel Belleville

unread,
Jul 15, 2014, 9:43:16 AM7/15/14
to i18n-r...@googlegroups.com
Hi Davide,

I'm happy to notice I'm not the only one with this problem (as happy as I can be considering nobody apparently had any clue since last year).

So, up?

Davide Barison

unread,
Jul 15, 2014, 10:19:16 AM7/15/14
to i18n-r...@googlegroups.com
Hi michel, i don't remeber how i fixed the problem.

This is last version i wrote

- (I18n.available_locales - [I18n.locale]).each do |l|
      %link{rel: 'alternate', hreflang: l, href: (request.protocol + request.host_with_port + url_for(locale: l)).html_safe}

And in gemfile:

gem 'rails-translate-routes', :git => 'git://github.com/aqabawe/rails-translate-routes'

I remeber i've used this fork for utf8 chars support in routes.
take a try let me know if it works
Reply all
Reply to author
Forward
0 new messages