url_for problems

Skip to first unread message

Davide Barison

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='' hreflang='en' rel='alternate'>
    <link href='' hreflang='ja' rel='alternate'>

instead of

 <link href='' hreflang='en' rel='alternate'>
    <link href='製品' hreflang='ja' rel='alternate'>

I'm using rails 3.2.14

any help? this is a bug?


Michel Belleville

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

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
0 new messages