Translate custom post type and taxonomy slug in URL?

So firstly whilst this may be possible I imagine that it is probably not best practice. This is because semantically, and for SEO it makes more sense to have fewer URLs.

It could be understood that if your page is /en/foo and I want to switch to French, I can just go to /fr/foo. People may do this manually, and some automated tools may understand the site works like this. If a person or a tool also has to translate ‘foo’ to French to find the correct page, this is more complicaed and it means everyone has to agree on translations as well as language codes, and translations may not always be 100% the same.

I think this is why it’s hard to find solutions to this in searching – generally it is not done so that URLs stay as similar as possible and only the language part changes.

If you do want to do it and you don’t have many languages, one way to do this would be to find the manual translations and add .htaccess rules to invisbly rewrite the URL with rules in your root .htaccess something like:

RewriteRule ^/sv/produkter(/.*) /en/product$1 [L]

This would be easy to do as long as you didn’t have many slugs or languages to do it for.

There’s also some possibility the PolyLang plugin might do this but you’d need to look into that further. See point 3 here: https://polylang.pro/doc/url-modifications/