Internationalization - Content redirection by slug/id
g
guicsou-lw
The main issue behind this is that I can not (natively) find the content I want based on slug/ID + locale.
For example, I have the same blog post translated to three languages, Strapi creates three different posts and map them. This mapping works well on the Strapi admin dashboard, however it is a struggle to use the API.
Example:
post-pt
post-en
post-es
When querying a specific post, like 'post-en' for example and passing the locale 'es', GraphQl doesn't return me anything because the locale does not correspond to the slug requested.
I'd like to redirect the content to the specific locale, this way I can always have the translated content without manual injection.
This way, if someone selected the English language in the website and (for some reason) is redirected to a content in another language, the user will always see content his language.
Waldemar Enns
Any updates here? Waiting for it �
Ricardo Agustín Moran Rivas
Hello there!
Yeah, this definitely should be a feature that the Strapi Internationalization Plugin handles by itself.
For now, I have written the following article explaning how to handle this in a Next.js App Router Project (but probably you can take the base concept to anywhere) that maybe could help someone.
Waldemar Enns
Ricardo Agustín Moran Rivas thanks for the referrence! Btw. I really like ypur page and am waiting for more blog content 👍�
Nicholas Bérubé
I currently work around this by adding a field "common_slug" to my collection types on which I disable localization for.
I have a "slug" field that is localized that I use to show a different url for each locale.
When I query my english blog, I can get the french blog's slug using the "common_slug" and the blog's locale.
Rortan
Any updates on this?
Ahmed Eid
+2 for this. We want to have localized slugs that are good for Google search results.
C
Chris
+1 for this. We want to have localized slugs that are good for Google search results. When the user hits a foreign page by accident we want to redirect them to the correct slug.