Stephen
Stephen

Reputation: 6329

Post process URLs to include language code and location

I'm trying to have the URLs on my app being rendered as /<language-code>/<city>/rest/of/url/, with the language code being the currently active language and the city being a location the user selects....it's a bit like what's being done at Heart, but now with the i18n bit included.

How can I go about enabling this for my site? I'm leaning towards a middleware solution as I believe this will be easy to use and will not involve modifications to the existing URLs. Any help on this will be appreciated.

Upvotes: 0

Views: 115

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599966

Wow - I created that functionality for Heart, and I never thought anyone would want to replicate it anywhere..

In any case, assuming you're talking about the outputting of URLs within links on regionalised pages, we did achieve that in middleware. I actually wrote a blog post about it - the post is really about a separate issue, but does provide example code.

Upvotes: 2

Related Questions