Skip to main content
deleted 38 characters in body
Source Link
nicael
  • 2.4k
  • 7
  • 28
  • 48

I'm working on a multilingual site with english and spanish locales. I've built persistent switcher that resides in the site footer. When users click it, it redirects to a corresponding entry in the other locale if one exists and the homepage if one does not.

The problem is that I have a handful of pages on my site that aren't entries: they are routes that are tied to particular templates. For example:

news-events/tags

Is the route for a template that lists all tags in use in my news section, and:

noticias-eventos/tags

would be the corresponding route on the spanish site.

I'd like to be able to check if the current uri is covered by a route and if so, whether there is a corresponding route in the other locale. If so, I'd redirect to that and if not, back to the homepage as per usual.

But from what I can see, routes are not localizable and exist independently of each other. Am I wrong? How would I go about this? Any ideas are appreciated.

Thanks!

I'm working on a multilingual site with english and spanish locales. I've built persistent switcher that resides in the site footer. When users click it, it redirects to a corresponding entry in the other locale if one exists and the homepage if one does not.

The problem is that I have a handful of pages on my site that aren't entries: they are routes that are tied to particular templates. For example:

news-events/tags

Is the route for a template that lists all tags in use in my news section, and:

noticias-eventos/tags

would be the corresponding route on the spanish site.

I'd like to be able to check if the current uri is covered by a route and if so, whether there is a corresponding route in the other locale. If so, I'd redirect to that and if not, back to the homepage as per usual.

But from what I can see, routes are not localizable and exist independently of each other. Am I wrong? How would I go about this? Any ideas are appreciated.

Thanks!

I'm working on a multilingual site with english and spanish locales. I've built persistent switcher that resides in the site footer. When users click it, it redirects to a corresponding entry in the other locale if one exists and the homepage if one does not.

The problem is that I have a handful of pages on my site that aren't entries: they are routes that are tied to particular templates. For example:

news-events/tags

Is the route for a template that lists all tags in use in my news section, and:

noticias-eventos/tags

would be the corresponding route on the spanish site.

I'd like to be able to check if the current uri is covered by a route and if so, whether there is a corresponding route in the other locale. If so, I'd redirect to that and if not, back to the homepage as per usual.

But from what I can see, routes are not localizable and exist independently of each other. Am I wrong? How would I go about this?

Source Link

How do I redirect to a corresponding route when user switches languages?

I'm working on a multilingual site with english and spanish locales. I've built persistent switcher that resides in the site footer. When users click it, it redirects to a corresponding entry in the other locale if one exists and the homepage if one does not.

The problem is that I have a handful of pages on my site that aren't entries: they are routes that are tied to particular templates. For example:

news-events/tags

Is the route for a template that lists all tags in use in my news section, and:

noticias-eventos/tags

would be the corresponding route on the spanish site.

I'd like to be able to check if the current uri is covered by a route and if so, whether there is a corresponding route in the other locale. If so, I'd redirect to that and if not, back to the homepage as per usual.

But from what I can see, routes are not localizable and exist independently of each other. Am I wrong? How would I go about this? Any ideas are appreciated.

Thanks!