WMPL: How to translate option pages

Support MB Settings Page WMPL: How to translate option pagesResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28853
    MarcoMarco
    Participant

    I've installed MB (AIO) and created a options page with some fields in several tabs.
    I can not get the field content translatable with WMPL. With ACF options pages are translatable by changing the content language with the dropdown in admin bar. With MetaBox this seems not to work. The field content is also not available as translatable Strings.

    In an old forum topic there is mentioned the wpml-config.xml
    Is this still needed? I tried using the xml config field in WPML configuration settings but had no luck.

    Is there a simple example for a translatable options page field value i can get a glue from?

    Thanks in advance!

    #28862
    Long NguyenLong Nguyen
    Moderator

    Hi Marco,

    To translate the custom fields in the settings page, please create the file wpml-config.xml in your theme/child theme folder, then add this code to that file

    <wpml-config>
        <admin-texts>
            <key name='option_name'>
                <key name='field_id' />
            </key>
        </admin-texts>
    </wpml-config>
    

    Translate the field value in WPML > String translation, show the field value by using the WordPress function get_option()

    <?php 
        $options = get_option( 'option_name' );
        echo $options['field_id'];
    ?>

    See my screen record https://share.getcloudapp.com/QwuA02PY

    #28870
    MarcoMarco
    Participant

    Hello Long, thank you very much. This helps a lot!
    This shoul be a part of the documentation. 🙂

    Are you planning to enhance the compatibility so that MetaBox Option Pages are translatable the same way and without creating xml files like ACF do? For our clients the Usage of String Translation is harder than just change the language and fill the options page forms.

    #28883
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Thank you for your feedback.

    I'm going to inform the developer team to consider adding it to the to-do list for the future development of the plugin.

    #45287
    AdrienAdrien
    Participant

    Any new regarding this? When we have lot and lot of MB custom fields we can't rely on the fact that we need to add them each time inside the wpml-config.xml, it should be automatic or at least having the ability to translate MB fields inside a MB setting page.

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