gilsdav / ngx-translate-router

Translate routes using ngx-translate
131 stars 43 forks source link

Get Translated Route of a different language than the current one #108

Open mmsergi opened 3 years ago

mmsergi commented 3 years ago

Hi! I want to set up some SEO tags for different langs like:

<link rel="alternate" hreflang="en" href="https://www.example.co/en/blog">
<link rel="alternate" hreflang="es" href="https://www.example.co/es/blog">

The unique method that seems to exist is "translateRoute" but only returns the current lang url.

My problem is I can't access at the same time to both href (url), is there a way to get it?

Thanks community.

gilsdav commented 2 years ago

This feature looks interesting. Have you found a workaround?

romankh commented 2 years ago

I am also looking for a way to achieve this. What is needed from my perspective is a method that returns the current url in a language provided by param, like this.localizeRouterService.translateCurrentUrl('en)

As far as I have seen, method changeLanguage does something similar, but also changes the language and navigates.

Would it be possible to implement

in LocalizeRouterService ?

motiejunas commented 1 year ago

Is there any plans on implementing this?