Giter VIP home page Giter VIP logo

Comments (4)

dmasur avatar dmasur commented on August 14, 2024

Hi there,

i am running into exactly the same problem.

from route_translator.

tanguyantoine avatar tanguyantoine commented on August 14, 2024

maybe use 'en' instead of :en

from route_translator.

mkon avatar mkon commented on August 14, 2024

You are right that it goes away if locale is a string. Still it seems weird that get :index, locale: :es, format: :json fails and requires a string, while get :index, locale: :es is working just fine.

from route_translator.

tagliala avatar tagliala commented on August 14, 2024

Hi,

I was looking at this issue.

Just a little consideration about the format

With rails 4.2.5, the process meethod (used by get) apparently doesn't allow to specify format: http://api.rubyonrails.org/classes/ActionController/TestCase/Behavior.html#method-i-process

In Rails 5, process method changed and it allows to specify a format: https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/test_case.rb#L431

...let's go back to the issue

If you put a resource inside a localized block, you are required to provide a locale param with a string value.

localized do
  resources :products, only: :index
end

results into this route:

(byebug) @routes.routes.first.requirements
{:locale=>"ru", :controller=>"products", :action=>"index"}

while

resources :products, only: :index

results into:

(byebug) @routes.routes.first.requirements
{:controller=>"products", :action=>"index"}

So I would say that this is not an issue and you should provide the locale as a string

Let me know if I'm missing something or if I'm wrong

Meanwhile, closing bere

from route_translator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.