Why isn’t my custom post type archive URL translating?

UPDATE 1:

I haven’t find a solution yet (other than using Polylang Pro). But I must add that my original question was partially wrong, since the rewrite option is for the single page url, not the archive one.

Custom post type archive has its own slug and it’s the has_archive option (can be boolean or string). So basically can be something like this:

'has_archive' => __('products','mytxtdomain')

Though, just as the rewrite url, it doesn’t work, and probably the answer below is still valid.


The answer is: it’s not possible.

Falks or the Polylang Pro crew explained me the reason why:

If you flush your rewrite rules while the locale is Italian, your slug is evaluated to ‘vini’. If you flush them while the locale is English, the slug is evaluated to ‘wine’. So, in the first case, the rewrite rule pattern is:

vini/([^/]+)(?:/([0-9]+))?/?$

and in the second case, it is

wine/([^/]+)(?:/([0-9]+))?/?$

But you never have both at the same time. So only one is working.