Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internationalization with prefix of locale #474

Open
odorisioe opened this issue Oct 14, 2016 · 0 comments
Open

Internationalization with prefix of locale #474

odorisioe opened this issue Oct 14, 2016 · 0 comments
Projects

Comments

@odorisioe
Copy link

odorisioe commented Oct 14, 2016

Hello,

I am looking an option to add a prefix with the locale on all the route except for public.

  1. I can do this but it include public
    app.use('/:locale',kraken(options));

  2. I created a folder called ":locale" to use like a dynamic and it works for the controller but doesn't detect the parameter.
    I thought it was because my middleware is before the router but doesn't work if I try on the final function and is undefined. (Update: I can use the parameter on the final route if I add mergeParams: true.)

/controller/:locale/index.js

  1. Now I am trying just one file: controller/index.js where I included all the routes and I set the param :locale on all of them.
    router.get('/:locale/home', function (req, res) { ... }

I think these are the most "clean" options that I found.
I like the first but include the public resources.
The option two is good but I don't know how flexible is the controller tree to create dynamic parameters

Could you tell me which is the best way and if there any way to exclude the public folder please?
Also I would like check the :locale param on a middleware but req.params is undefined except for the option 1. Is any way to do it on the another options?

Many thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant