WPML translation of Meta Box Select and Checkbox field
- This topic has 5 replies, 2 voices, and was last updated 3 years, 2 months ago by
Long Nguyen.
-
AuthorPosts
-
September 16, 2022 at 1:06 AM #38324
Arno
ParticipantHi,
I have a Meta Box Select and Checkbox field which both work fine in English. However, the options still show as English on a German post too.
Here's what I have in the choices box of the Select field:
1:Paid
2:Free for all
3:Free for pass holdersWhere do I translate that?
Also, I can't find how to translate Yes and No for the Checkbox field.
Both fields are set as Copy in WPML Custom Fields Translation, because their value requires no translation, it just needs to be available for the secondary languages. But the option labels need to be translated and I can't find how to do it.
September 16, 2022 at 11:38 PM #38334Long Nguyen
ModeratorHi,
To translate the field label, you have to register the custom fields with code to add the textdomain for the string. Please read more on these topics
https://support.metabox.io/topic/multilanguage-support-for-custom-post-type-labels/
https://support.metabox.io/topic/unable-to-translate-cpt/and this documentation https://developer.wordpress.org/themes/functionality/internationalization/
September 17, 2022 at 2:52 PM #38342Arno
ParticipantHi Long,
Sorry, I don't understand what exactly I need to do. It's only about two fields, but are you suggesting I should copy the PHP for ALL post types and taxonomies to a script? And then disable the extension "MB Custom Post Type" (or is that optional)? And then do that all over again for each config change in the future? That's not doable, but perhaps I misunderstood?
Please provide all steps you're suggesting to make these fields fully translatable.
If you can fix this in Meta Box that would be better. It's only two fields, so there's no hurry and I can wait for the update.
Thank you!
September 19, 2022 at 11:28 AM #38347Long Nguyen
ModeratorHi Arno,
What I mean is to register the custom fields by PHP code like custom post type, you can follow the documentation to get the PHP code and add it to the file functions.php in the theme/child theme or a custom plugin folder.
https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code
Then you can use WPML to scan the translatable text with the text domain registered.September 20, 2022 at 1:27 AM #38355Arno
ParticipantHi Long,
Ok, thanks. I found a different work around by using the facetwp_facet_display_value hook of FacetWP: https://facetwp.com/help-center/developers/hooks/output-hooks/facetwp_facet_display_value/. Since it's a only a few strings, that are only used in facets of FacetWP, I was able to translate them in a custom script. For now, that seems to be the easier solution.
September 20, 2022 at 8:54 AM #38358Long Nguyen
ModeratorLet me know if you have any questions.
-
AuthorPosts
- You must be logged in to reply to this topic.