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.

This topic contains 3 replies, has 0 voices.

Last updated by jiriZ-6 1 month, 1 week ago.

Assisted by: Otto.

Author Posts
April 24, 2025 at 9:02 pm #16966344

jiriZ-6

We'll test it. I have another problem: we have json field and WPML doesn't want translate it (other fields are fine). I attach screesnshots. What options do we have?
Probably we can remake this field if it's required... But we don't want to translate 50 fields, it's more convinient to have all field's translations in one place.

April 24, 2025 at 9:07 pm #16966376

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hi,

WPML skips values that are stored as raw JSON unless you tell it how to decode them.
You have two main ways forward:

As you mentioned, split the JSON in several fields OR

Keep the single JSON field and let WPML decode it

1. Go to WPML → Settings → Custom XML Configuration.
2. Paste the following (replace your_json_field with the real custom-field key):

<wpml-config>
  <custom-fields>
    <!-- Decode the value as JSON and make it translatable -->
    <custom-field action="translate" encoding="json">your_json_field</custom-field>
  </custom-fields>

  <!-- Optional: list only the JSON keys you really need -->
  <!--
  <custom-fields-texts>
    <key name="your_json_field">
      <key name="title" />
      <key name="description" />
    </key>
  </custom-fields-texts>
  -->
</wpml-config>

3. Save, then make a tiny change (e.g. add a space) in the original post to trigger an update.
4. Open the translation job – the JSON keys now appear as individual strings.

• The encoding="json" attribute tells WPML to parse the field:
https://wpml.org/documentation/support/language-configuration-files/custom-fields-translation-options/
• Limiting keys with <custom-fields-texts> prevents 50+ unnecessary strings.
• A similar workaround is already used for the core Footnotes block:
https://wpml.org/errata/wordpress-footnotes-block-not-translatable/

Best Regards,
Otto

April 25, 2025 at 1:05 pm #16968705

jiriZ-6

I tried to add a scheme, somehow it didn't work. Could you please check it? Field name is "json".
<wpml-config>
<custom-fields>
<!-- Decode the value as JSON and make it translatable -->
<custom-field action="translate" encoding="json">json</custom-field>
</custom-fields>

<!-- Optional: list only the JSON keys you really need -->
<custom-fields-texts>
<key name="json">
<key name="Amazon EMEA">
<key name="country"/>
<key name="input_language">
<key name="*"/>
</key>
<key name="competitors">
<key name="*"/>
</key>
<key name="monthly_fee"/>
</key>
<key name="Amazon Americas">
<key name="country"/>
<key name="input_language">
<key name="*"/>
</key>
<key name="competitors">
<key name="*"/>
</key>
</key>
<key name="Amazon APAC">
<key name="*">
<key name="country"/>
<key name="input_language">
<key name="*"/>
</key>
<key name="competitors">
<key name="*"/>
</key>
<key name="gmv"/>
<key name="monthly_fee"/>
</key>
</key>
</key>
</custom-fields-texts>
</wpml-config>

Field content:
{"Amazon EMEA":[{"country":"Belgium","monthly_traffic":"22M","input_language":["French","Dutch"],"currency":"EUR","monthly_fee":"EUR 39","competitors":["Bol.com","Zalando","ManoMano"],"register_link":"hidden link"},{"country":"France","monthly_traffic":"150M","input_language":["French"],"currency":"EUR","monthly_fee":"EUR 39","competitors":["Cdiscount","Veepee/Privalia","Fnac/Darty"],"register_link":"hidden link"},{"country":"Germany","monthly_traffic":"410M","input_language":["German"],"currency":"EUR","monthly_fee":"EUR 39","competitors":["Zalando","Otto"],"register_link":"hidden link"},{"country":"Italy","monthly_traffic":"160M","input_language":["Italian"],"currency":"EUR","monthly_fee":"EUR 39","competitors":["Yoox","eBay","ePrice"],"register_link":"hidden link"},{"country":"Netherlands","monthly_traffic":"21M","input_language":["Dutch"],"currency":"EUR","monthly_fee":"EUR 39","competitors":["Bol.com","Wehkamp","Zalando"],"register_link":"hidden link"},{"country":"Poland","monthly_traffic":"14M","input_language":["Polish"],"currency":"PLN","monthly_fee":"PLN 165","competitors":["Allegro","Zalando","AliExpress"],"register_link":"hidden link"},{"country":"Spain","monthly_traffic":"125M","input_language":["Spanish"],"currency":"EUR","monthly_fee":"EUR 39","competitors":["El Corte Inglés","MediaMarkt","AliExpress"],"register_link":"hidden link"},{"country":"Sweden","monthly_traffic":"13M","input_language":["Swedish"],"currency":"SEK","monthly_fee":"SEK 410","competitors":["CDON","Ellos","H&M"],"register_link":"hidden link"},{"country":"Saudi Arabia","monthly_traffic":"15M","input_language":["English","Arabic"],"currency":"SAR","monthly_fee":"No fee*","competitors":["Noon","Sharaf DG","Namshi"]},{"country":"South Africa","monthly_traffic":"Data Unavailable","input_language":["English"],"currency":"ZAR","monthly_fee":"No fee*","competitors":["Takealot"],"register_link":"hidden link"},{"country":"UK","monthly_traffic":"328M","input_language":["English"],"currency":"GBP","monthly_fee":"GBP 25","competitors":["eBay","ASOS","OnBuy"],"register_link":"hidden link"},{"country":"Turkey","monthly_traffic":"43M","input_language":["Turkish"],"currency":"TRY","monthly_fee":"TRY 99","competitors":["Trendyol","Hepsiburada","Tekzen"]},{"country":"UAE","monthly_traffic":"19M","input_language":["English","Arabic"],"currency":"AED","monthly_fee":"No fee*","competitors":["Noon","Sharaf DG","Namshi"]}],"Amazon Americas":[{"country":"US","gmv":"407B","monthly_traffic":"2.2B","input_language":["English"],"currency":"USD","monthly_fee":"USD 39.99*","competitors":["Walmart","eBay","Target"],"register_link":"hidden link"},{"country":"Brazil","gmv":null,"monthly_traffic":"Data Unavailable","input_language":["Portuguese"],"currency":"BRL","monthly_fee":"BRL 19","competitors":["Mercado Libre","Americanas","Magazine Luiza"]},{"country":"Mexico","gmv":null,"monthly_traffic":"71.7M","input_language":["Spanish"],"currency":"MXN","monthly_fee":"MXN 600","competitors":["Mercado Libre","Coppel","Walmart"]},
{"country":"Canada","gmv":"30.1B","monthly_traffic":"150.2M","input_language":["English","French"],"currency":"CAD","monthly_fee":"CAD 29.99","competitors":["eBay","The Bay","Walmart"]}],"Amazon APAC":[{"country":"Australia","gmv":"$2.6 billion","monthly_traffic":"42.5M","input_language":["English"],"currency":"AUD","monthly_fee":"AUD 49.95","competitors":["eBay","Catch","MyDeal"]},{"country":"India","gmv":null,"monthly_traffic":"286.4M","input_language":["English"],"currency":"INR","monthly_fee":"Varies by product category","competitors":["Flipkart","Myntra","Paytm Mall"]},{"country":"Japan","gmv":"¥707B*","monthly_traffic":"543K","input_language":["Japanese"],"currency":"JPY","monthly_fee":"JPY 4900","competitors":["Rakuten","Yahoo! Japan","Mercari"]},{"country":"Singapore","gmv":null,"monthly_traffic":"5.9M","input_language":["English"],"currency":"SGD","monthly_fee":"SGD 29.95","competitors":["Shopee","Lazada","Zalora"]}]}

April 25, 2025 at 1:08 pm #16968721

jiriZ-6

You can ignore it, it started to work.