title: Rails 4 i18n, how to translate routes where subdomain is used for the locale
body: <p>I am using subdomains to determine the locale in a Rails 4 website. I have this working with a locale switcher exactly the way I want it but now I need to translate the routes and I'm not sure about the best way to proceed.</p>
  
  <p>I have looked the <a href="https://github.com/kwi/i18n_routing">https://github.com/kwi/i18n_routing</a> i18n routing gem but this doesn't work with subdomains, it seems to change the path by adding /locale which is not what I need.</p>
  
  <p>Other gems seem to be out of date with Rails 4.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Basically I want to be able to use the same view helpers but have the urls change to use whatever language is reflected by the selected sub-domain. this is just about route translation.</p>
  
  <p>I have language specific templates which work and I can produce language spevific navigation templates but I would really like to not have to worry about changing erb path and url erb tags</p>
  
  <p><strong>End edit</strong></p>
  
  <p>A sample from routes.rb</p>
  
  <pre><code>scope module: 'countries', shallow: true do
  
    get 'south_american', to: 'south_america#index', as: :south_america
    scope module: 'south_america' do
      get 'south-america-weather', to: 'weather#index', as: :south_america_weather
      get 'south-america-gps-maps', to: 'gps#index', as: :south_america_gps
      get 'south-america-accommodation', to: 'hotels#index', as: :south_america_hotels
      get 'south-america-vacations', to: 'vacations#index', as: :south_america_vacations
      get 'south-america-facts', to: 'facts#index', as: :south_america_facts
    end
  </code></pre>
  
  <p>Using south_america_hotels_path as an example will generate a url for </p>
  
  <blockquote>
    <p>south-america-accommodation</p>
  </blockquote>
  
  <p>which is great but how would I translate this so that when I am on the Spanish subdomain south_america_hotels_path will generate the following url</p>
  
  <blockquote>
    <p>hoteles-en-sudamerica</p>
  </blockquote>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Also how would this work for a url rather than just a path so that
  south_america_hotels_url will generate</p>
  
  <blockquote>
    <p>en.some_site/south-america-accommodation</p>
  </blockquote>
  
  <p>and when on the spanish subdomain I would get</p>
  
  <blockquote>
    <p>es.some_site/hoteles-en-sudamerica</p>
  </blockquote>
  
  <p>and so on for the different locales involved.</p>
  
  <p>I am happy to use yml files for the translations for the urls or to define the additional routes in the routes.rb file, either is an option but I would prefer to define the url's in the routes.rb but I am unable to find a way to provide language specific urls for the same :as path/url option based on subdomain.</p>
  
  <p><strong>Update and further clarification in response to previous replies.</strong></p>
  
  <p>Changing the url's is not an option, they need to match existing url's. I just need to know how to translate them from a view helper point of view without having to change the view helpers.</p>