How to configure translatable custom fields for the Supertext WordPress translation plugin

Custom fields (Custom Fields – WordPress.org Forums) can contain any kind of extra information for the assigned post. Some custom fields might contain translatable text that is rendered as part of the post content. There is a setting for the Supertext Translation plugin where those custom fields can be defined. This way the translation plugin knows which field to sent for translation.

Custom fields from other plugins (e.g. Advanced Custom Fields)

The Supertext translation plugin will list custom fields of a few known plugins under Settings->Supertext->Translatable Fields. Those plugins are:

  • Advanced Custom Fields (incl. Pro version)
  • Yoast SEO
  • All In One SEO pack
  • BE page builder

Select the translatable fields and click on Save settings.

“Translatable text field” is translatable. “A number field” is not.

Elementor page builder plugin

The Elementor page builder uses custom fields to save post content. There is a standard set of widgets with well known properties that contain translatable text. Those are predefined if Elementor is installed.

Standard properties used for saving translatable text.

One can add names of other properties used by custom/additionally installed widgets. This is needed when a widget doesn’t save the text under one of the properties listed above (e.g. the widget uses “description” as property and not “text”). In this case click on Add text property, enter the property name (e.g. “description”) and click on Save settings.

If you don’t know how the field is called, you can select the component in Elementor and then switch to Inspect mode. There you should find the name under data-elementor-setting-key.

General custom fields

There is also the possibility to define translatable custom fields by entering their names. This can be used for any custom field – those from other plugins or directly added on the post.

Click on Add field, enter the name of the custom field and click on Save settings.

“TranslatableExampleField” as a translatable custom field

Trick to figure out where the content is saved (for developers)

There are a few tricks to figure out the names of the custom fields or object properties (e.g. when using Elementor).

Preview feature when ordering a translation

There is a feature to show the content that will be sent for translation when placing a translation order.

A modal dialog will show the text that will be sent for translation. There is a hidden HTML pre tag on the dialog that contains all raw content found by the translation plugin related to the post. This tag can be displayed and used to figure out where the text has been saved.

  1. Open the modal dialog by click on Show content.
  2. Open the develop tools in your browser (ctrl+shift+I)
  3. Open the Elements tab with the DOM tree.
  4. Search for .sttr-item-content pre (selector search for the specific pre tag under div with class .sttr-item-content)
  5. Select the pre tag and remove the display: none css attribute to show the tag.
  6. Search for the text (e.g. the text that is shown on the page but no sent for translation)
  7. Copy the name of the custom field and save it as translatable field in the Supertext translation plugin as described above.
The text “This is some sample text that should be translated.” is not displayed here and missing
Show the pre tag shows the text and under which custom field it is saved (“HiddenCustomFieldWithText” in this example)

Custom fields and WPML

There is a setting in WPML that lists all existing custom fields. It is used to tell WPML what field is translatable and should be copied over to the translations. This can also be used to check the exact name of the field if unsure. This setting can be found under WPML->Settings->Custom Fields Translation.




Ähnliche Beiträge


Leave a Reply

Your email address will not be published. Required fields are marked *



*