WPML translation of Meta Box Select and Checkbox field

Support General WPML translation of Meta Box Select and Checkbox fieldResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #38324
    ArnoArno
    Participant

    Hi,

    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 holders

    Where 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.

    #38334
    Long NguyenLong Nguyen
    Moderator

    Hi,

    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/

    #38342
    ArnoArno
    Participant

    Hi 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!

    #38347
    Long NguyenLong Nguyen
    Moderator

    Hi 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.

    #38355
    ArnoArno
    Participant

    Hi 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.

    #38358
    Long NguyenLong Nguyen
    Moderator

    Let me know if you have any questions.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.