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.
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.
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.
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.
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.
- Open the modal dialog by click on Show content.
- Open the develop tools in your browser (ctrl+shift+I)
- Open the Elements tab with the DOM tree.
- Search for .sttr-item-content pre (selector search for the specific pre tag under div with class .sttr-item-content)
- Select the pre tag and remove the display: none css attribute to show the tag.
- Search for the text (e.g. the text that is shown on the page but no sent for translation)
- Copy the name of the custom field and save it as translatable field in the Supertext translation plugin as described above.
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.