Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are trying to translate data retrieved from a third-party job board API on your website's homepage under 'Find your next opportunity' and are unsure how to proceed.
Solution:
We recommend the following steps:
1. Ensure that the content imported from the API is saved as a regular WordPress post.
2. You can then use WPML to translate this content. You have two main options:
- Enable automatic translation to process the content as soon as it's available.
- Manually send the content for translation via the Translation Management Dashboard.
3. If the content is included directly inside a page, simply translate the page itself.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please open a new support ticket at WPML support forum.

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.

Tagged: 

This topic contains 3 replies, has 0 voices.

Last updated by Marcel 4 weeks, 1 day ago.

Assisted by: Marcel.

Author Posts
January 16, 2025 at 4:04 pm #16602942

markP-34

Background of the issue:
I am trying to translate data retrieved from a third-party job board API on the home page of my website, hidden link, under 'Find your next opportunity'.

Symptoms:
I am unsure how to translate the job data after retrieving it from the API.

Questions:
How can I translate data retrieved from a third-party API using WPML?

January 16, 2025 at 4:43 pm #16603137

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

Once the content is imported and saved as a regular WordPress post, WPML can handle it in several ways:

- You can enable automatic translation to process the content as soon as it's available.
- Alternatively, you can manually send the content for translation via the Translation Management Dashboard.

From what I understand, this doesn’t appear to involve a specific custom post type (CPT). How is the content currently managed after it’s imported? IS this included inside the page? If yes, you just need to translate the page itself.

Best regards,
Marcel

January 16, 2025 at 5:17 pm #16603263

markP-34

These jobs are changing dynamically according to the real-time available jobs, how we can solve this problem? How do you translate the variable on the custom template, i usually use string translation for static string translation, but this is variable, so any other solutions for this? Thanks

Example: this is how we get title of the job: {$postings->data[$i]->title}

January 16, 2025 at 5:59 pm #16603338

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Where is the content stored? Are you importing it into the post ID, a custom table, or custom fields? Please provide more details.

Keep in mind that if the translation status remains unchanged, even an update may not trigger the automatic translation process. This method of import might not be ideal. If you were to import the content into a custom post type (CPT) and load it via a query, the jobs would become accessible as post IDs, allowing you to translate them more effectively.

How do you translate the variable on the custom template, i usually use string translation for static string translation, but this is variable, so any other solutions for this? Thanks

To handle string translations, you can utilize the following WPML hooks:

- wpml_register_single_string to register the string for translation.
- wpml_translate_single_string to retrieve and output the translated variable.

Best regards,
Marcel