Custom Fields
Re-Envisioned
Support MB Settings Page WMPL: How to translate option pages

  • Creator
    Topic
  • #28853
    Resolved Marco
    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #28862
    Long 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
    Marco
    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 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.

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