Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 -
- 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 -

Supporter timezone: Asia/Kathmandu (GMT+05:45)

This topic contains 23 replies, has 2 voices.

Last updated by Shekhar Bhandari 1 year, 4 months ago.

Assisted by: Shekhar Bhandari.

Author Posts
September 21, 2023 at 12:14 pm #14438611

theofanisX

I am using the rest woocomeerce api to translate the products. With the categories is worked just fine. When i am trying to translate an attribute i can't. Futhermore i can;t even translate it also from the admin panel.
Also i tried a translation via api for the terms of the attribute. It stores two different attributes but it doesn't make the connection "translation of."

Can you assist?

September 22, 2023 at 6:36 am #14443549

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello markH-6,

Welcome to WPML support. I'd like to help you further on this issue.

Are you following the steps as mentioned here?
https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

Further, We recently released a new version of WPML plugins so can you please update the plugins to the latest version and let me know if that helps.

We push out WPML releases gradually. If your sites haven’t received this update yet, give it some time and you’ll see the update in a few days.

To skip the queue and get the update right away, to the Plugins → Add New page, click the Commercial tab and then click the Check for updates button.
https://wpml.org/wp-content/uploads/2020/04/wpml-force-plugin-update-1.png

Note: Keep a Backup Before Updating

Look forward to your reply.

Thanks

September 27, 2023 at 7:33 am #14470825

theofanisX

Hello again.
We still facing the issue. We have the latest version of WPML but still can't translate the attributes or the terms. Can you give me an exaple in postman for the translation of the attribute? Also, is there any settings that we need to check twice about the translation of the attributes?

Regards

September 27, 2023 at 8:33 am #14471373

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

For global attributes, it's only possible to translate the labels and you can do this using UI, I don't think it's possible to use rest API to translate just the labels for now.

In terms of attributes, you can follow the steps as mentioned here:

To create in default language
Postman URL: hidden link
Body Json

{
    "name": "Small",
    "slug": "small",
    "description": "Small size",
    "menu_order": 1,
}

To create in secondary language
Postman URL: hidden link
Body Json

{
    "name": "Small-fr1",
    "slug": "small-fr1",
    "description": "Small size",
    "menu_order": 1,
    "translation_of": 25,
    "lang": "fr"
}

Two parameters are supported when creating a term:

lang – the respective lang value will be set for the term. If omitted, the default language of the site will be used.
translation_of (optional) – the term will be created as a translation of an existing term, having the id provided by the value of translation_of. If translation_of is omitted, the term is created as part of a new translation group (trid)

Documentations:
+ https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/
+ https://woocommerce.com/document/woocommerce-rest-api/
+ hidden link

Let me know if this helps.

Thanks

September 27, 2023 at 8:56 am #14471831

theofanisX

The example that you send me is for the terms. What about the attribute.
if i try to add an attribute via API like
hidden link
{
"name" : "Attr eng 1",
"slug" : "attr_eng_1",
"lang" : "en",
"translation of " : "31"
}
This one it doesn't work. It doesn't not create me the english version of the attriobute 31.

Regards

September 27, 2023 at 8:58 am #14471835

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

As mentioned in my previous reply, global attributes doesn't needs to be translated, you can only translate the labels of it and it's not possible with rest api.

Thanks

September 29, 2023 at 8:53 am #14486619

theofanisX

And how can i connect the english attribute with the english terms and the greek attribute with the greek term? Beacuse if i am getting it right you are saying that i have 1 attribute and i am linking it with terms (translated terms). But my attributes are in greek, and if i cant translate them it will show them in greek also in the english site.

September 29, 2023 at 9:01 am #14486683

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

On the provided examples URLS: hidden link

1 is the attribute ID, so to add terms for it you need to use the above, URL and the same for adding translations.

Let me know if this helps.

Thanks

October 2, 2023 at 10:55 am #14497275

theofanisX

Hello.

So you're telling me that i can't translate either attributes nor terms from API. So i have to pute the clients or the devs to do it manually? This is not an option. Are we sure about it?

Regards

October 2, 2023 at 10:58 am #14497361

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

- You can create attributes from the API
- Attributes don't need translations, they have labels and this needs to be translated manually
- You can create terms for that attributes from API.
- You can create terms translations for that attributes from API.

Let me know if this is clear now.

Thanks

October 2, 2023 at 12:33 pm #14497943

theofanisX

It doesn't work. I am trying to add a term and its translation but it doesn't work.

Regards

October 2, 2023 at 12:35 pm #14497949

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Please provide more details regarding it, like the following:
- Postman URL
- JSON
- What type of authorization are you using
- Can you create an attribute without WPML?

Look forward to your reply.

Thanks

October 2, 2023 at 12:48 pm #14498039

theofanisX

Yes i can create attribute and terms via api. All my data entry is with api
and when i make a call for the translated term the greek term with the translated one are not connected, as you can see in the screenshots provided below.

tr.term.png
tr.term2.png
October 2, 2023 at 12:53 pm #14498155

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

To debug this issue further, I would need to check your site settings once, for this I would need temporary access (wp-admin and ftp) to your site.

So could you please provide me with those details, you will find the needed fields for this below the comment area when you log in to leave your next reply.
hidden link

This info is private and available to you and WPML supporters only.
Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note:
Backup your sites before providing the credentials or if possible provide credentials for the test site

Look forward to your reply.

Thanks

October 2, 2023 at 1:36 pm #14498407

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

The json you provided has the following

"translation of": 2043,

while the correct one is

"translation_of": 2043,

Can you try this and see if it helps?

Look forward to your reply.

Thanks

The topic ‘[Closed] Translate via API’ is closed to new replies.