Using
UsingSynchronizing and translating meta

Synchronizing and translating meta

Gato AI Translations for Polylang can synchronize and translate meta data from your theme and plugins.

Use this feature to translate your custom meta fields, or those from plugins not supported out of the box by Gato AI Translations for Polylang.

Meta fields by supported plugins, such as ACF, Meta Box, and several SEO plugins, are handled automatically.

How it works

In the Settings > Meta Configuration tab, define what meta keys to:

  1. Any value: Copy directly
  2. Strings: Copy and translate
  3. Entity IDs: Copy and replace with the corresponding entity ID for the target language
Configuring the meta keys for translation
Configuring the meta keys for translation

Each meta key can be defined via its name, or using a regex:

For instance, any of these entries match meta key "_myplugin_seo_title":

  • _myplugin_seo_title
  • /"_myplugin_seo_.*/
  • #"_myplugin_seo_([a-zA-Z]*)#

You can indicate if the provided entries are included, or excluded.

Copy directly

The meta value will be copied directly from the origin to the target entry.

Use inputs:

  • Copy Meta for Custom Posts and Media
  • Copy Meta for Tags and Categories

Copy and translate

The meta value will be copied and translated to the target language.

Use inputs:

  • Translate Meta for Custom Posts and Media
  • Translate Meta for Tags and Categories

Accepted meta values:

  • Single string. Eg:
"hello world"
  • Array of strings (deep to the last level). Eg:
["hello", "world", ["hello", "world"]]
  • Object of strings (deep to the last level). Eg:
{
  "level1_key1": "hello",
  "level1_key2": "world",
  "level2_key1": {
    "level3_key1": "hello",
    "level3_key2": "world"
  }
}
  • A combination of the above. Eg:
[
  "hello",
  "world",
  {
    "level1_key1": "hello",
    "level1_key2": "world",
    "level1_key3": {
      "level2_key1": [
        "hello",
        "world"
      ],
      "level2_key2": "hello world"
    }
  }
]

Copy and replace entity IDs

The meta value will be copied and replaced with the corresponding entity ID for the target language.

Use inputs:

  • Translate Entity References on Meta: Custom Posts and Media IDs
  • Translate Entity References on Meta: Tags and Categories IDs

Notice that both inputs apply when editing any entity: posts, tags, categories, and media.

For instance, a post can have a meta entry that references a list of tags, and those tags must be replaced with the corresponding entity IDs for the target language.

Accepted meta values:

  • Single entity ID. Eg:
123
  • Array of entity IDs (deep to the last level). Eg:
[123, 456, [123, 456]]
  • Object of entity IDs (deep to the last level). Eg:
{
  "level1_key1": 123,
  "level1_key2": 456,
  "level2_key1": {
    "level3_key1": 123,
    "level3_key2": 456
  }
}
  • A combination of the above. Eg:
[
  123,
  456,
  [
    123,
    456
  ],
  {
    "level1_key1": 123,
    "level1_key2": 456,
    "level2_key1": {
      "level3_key1": 123,
      "level3_key2": 456
    }
  }
]