Dynamic locale labels

Hi team,
I have a multilang site (WPML), 3 locales.
There is a taxonomy (product line) archive layout that provides structure to all product lines.
This layout has inner JSON-LD, templated to show dynamically the present context (taxonomy, locale).

Assume this JSON-LD fragment:

@type”: [“Thing”,“skos:Concept”],
“name”: [
{
@value”: “Los productos de esta línea contribuyen en {{dc:term:name}}”,
@language”: “es”
},
{
@value”: “Os produtos desta linha contribuem para {{dc:term:name}}”,
@language”: “pt-pt”
},
{
@value”: “Products in this product line contribute to {{dc:term:name}}”,
@language”: “en”
}
]

Assume I want this Schema no matter the locale version I’m browsing:

  • It is not showing the ES label when browsing ES locale
  • It is showing the 3 localized labels no matter the locale browsing.

In practice, if I’m on the Spanish archive, this fragment will get me:

  • Los productos de esta línea contribuyen en Salud Ocular
  • Os produtos desta linha contribuem para Salud Ocular
  • Products in this product line contribute to Salud Ocular

Then switch to PT and will read “Saúde Ocular” on the 3 spots, switch EN for 3x “Eye Health”.

How do I get each {{dc:term:name}} localized to its own language independently of the locale context?
I want to get coherent value labels like this, I.ex.

  • Los productos de esta línea contribuyen en Salud Ocular
  • Os produtos desta linha contribuem para Saúde Ocular
  • Products in this product line contribute to Eye Health

I need workaround or a property like {{dc:term:name locale=“es”}}

If this is not feasible without complexity, I’d turn this into a request for developing the “magic property”, similar to sizes in {{dc:post:featured_image size=“medium”}}, applied onto available locales.

Thank you for your attention, happy weekend

Hello Ricard,

Thank you for reaching out. I understand you need {{dc:term:name}} inside a taxonomy archive JSON-LD block to output the Spanish, Portuguese, and English term names side by side, while it currently returns only the translation for the language being browsed. Please review the steps below.

  1. Confirm the current behaviour is expected – Dynamic Content term fields have no language argument. The token resolves the term through WordPress, and WPML returns the translation matching the active language, so all three labels receive the same value. The only term selector available is term="ID", which points at a fixed term and is not suitable for an archive layout. A locale="es" argument does not exist today; please post this in the Feature Requests category so our developers can evaluate it.

  2. Use term meta as a workaround – Add three term meta fields to your taxonomy (for example name_es, name_pt, name_en) holding the fixed translated names, then reference them in the JSON-LD with {{dc:term:meta key="name_es"}}, {{dc:term:meta key="name_pt"}} and {{dc:term:meta key="name_en"}}. Because WPML stores each translation as a separate term, set these fields to copy across translations in WPML > Settings > Custom Term Meta Translation so every language version of the term carries all three values.

  3. Confirm your subscription tier – A PHP alternative is possible through the Dynamic Content API by filtering cs_dynamic_content_term to accept a language argument and resolve the translated term via WPML’s wpml_object_id filter. Custom PHP is provided under our Custom Coding tier, available to ONE package subscribers. Please confirm whether your account is on the ONE package and I will prepare the exact snippet for you.

Recommended Resources

Best Regards.