jonasblb
Forum Replies Created
-
Hi,
I see there are new versions of WooCommerce Multilingual (4.12.5). Is the attribute label translation issue working differently compared to 4.12.1?
The revision notes specify exact changes and I have a hard time guessing if they affect this issue.Is there any chance that I could hack around this issue with a filter, or by modifying something?
BR,
JonasHi, thank you for the fast response and the sandbox.
It seems I managed to reproduce similar behaviour on the sandbox install.
I added a test attribute, a test value of that attribute, as well as published a product with the test value. I added translations to all of these in the second language (spanish), and WooCommerce Multilingual Status page shows translations are complete.
Then using Postman I made some requests (with consumer key and secret as query parameters, omitted from below urls).
First, the product attributes endpoint on /wp-json/wc/v3/products/attributes did not translate the attribute label regardless of “lang” parameter “es” or “en”. It was always default (english).
Secondary observation: On this endpoint attribute options were not included in the response. On the production install I am working on they are always included, but may be unrelated.Second, to get the terms of the test attribute /wp-json/wc/v3/products/attributes/1/terms it was possible to use “lang” with both “es” and “en” to get the correct translated terms. Secondary observation: On this endpoint I observed some kind of caching behaviour, where if the “lang” parameter was omitted, results would be translated using lang parameter that was passed in any previous request to the API. In this case the previous endpoint was product attributes, meaning it does respect the “lang” parameter between requests, but it does not use it to translate product attribute labels.
Third, I tried all products /wp-json/wc/v3/products and that provided the correct spanish translations when “lang” parameter was set to “es”. However, in the “attributes” array of the product, the product attribute label (name) was still in english, but the option was translated to spanish.
From this I would guess that product attribute labels are never translated within the API, since the issue is exactly the same as on my production install.
Is there anything in particular I could investigate?
BR,
Jonas