Support

Account

Home Forums General Issues Internationalization in Lite Mode

Solving

Internationalization in Lite Mode

  • First of all I have to say that ACF is my favorite plugin and I want to thank Elliot for his great work.

    Here’s my scenario and question: I have build a WP Theme that I will offer as a premium theme. This theme will be translation ready. In the theme there are some Custom Post Types and the metaboxes are created with ACF and ACF is used in Lite Mode.

    The labels of the fields and the field instructions are entered in english. But if a user want to use the theme in another language he will see this in the post editor still in english in contrast to the other strings.

    Is there any way to translate the label and the field instructions as well?

    Thanks for any ideas
    Thomas

  • Hi @Thomas

    Yes, in your exported field data, you can wrap the field labels with the __(‘string’, ‘domain’) function

    This will allow you to translate the string in your theme

    I will be auto adding this function to the export data in the next version.

    Thanks
    E

  • Along those same lines, I’m doing something similar where I have the exported field group in php – via the advanced-custom-fields-wpcli plugin, but how do you import the php file so the translations work as intended?

    By the way, here’s the exported php field group:

    
    <?php
    $group = array (
      'id' => '53c211e33c2db',
      'title' => __('Example Field Group', 'mytheme'),
      'fields' =>
      array (
        0 =>
        array (
          'key' => 'field_53c211bcd1dbc',
          'label' => __('Example Field', 'mytheme'),
          'name' => 'example_field',
          '_name' => 'example_field',
          'type' => 'text',
          'order_no' => 0,
          'instructions' => '',
          'required' => 0,
          'id' => 'acf-field-example_field',
          'class' => 'text',
          'conditional_logic' =>
          array (
            'status' => 0,
            'rules' =>
            array (
              0 =>
              array (
                'field' => 'null',
                'operator' => '==',
              ),
            ),
            'allorany' => 'all',
          ),
          'default_value' => '',
          'placeholder' => '',
          'prepend' => '',
          'append' => '',
          'formatting' => 'html',
          'maxlength' => '',
          'field_group' => 72,
        ),
        1 =>
        array (
          'key' => 'field_53c211c3d1dbd',
          'label' => __('Example Text Area', 'mytheme'),
          'name' => 'example',
          '_name' => 'example',
          'type' => 'textarea',
          'order_no' => 1,
          'instructions' => '',
          'required' => 0,
          'id' => 'acf-field-example',
          'class' => 'textarea',
          'conditional_logic' =>
          array (
            'status' => 0,
            'rules' =>
            array (
              0 =>
              array (
                'field' => 'null',
                'operator' => '==',
              ),
            ),
            'allorany' => 'all',
          ),
          'default_value' => '',
          'placeholder' => '',
          'maxlength' => '',
          'rows' => '',
          'formatting' => 'br',
          'field_group' => 72,
        ),
      ),
      'location' =>
      array (
        0 =>
        array (
          0 =>
          array (
            'param' => 'post_type',
            'operator' => '==',
            'value' => 'post',
            'order_no' => 0,
            'group_no' => 0,
          ),
        ),
      ),
      'options' =>
      array (
        'position' => 'normal',
        'layout' => 'no_box',
        'hide_on_screen' =>
        array (
        ),
      ),
      'menu_order' => 0,
    );
    
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Internationalization in Lite Mode’ is closed to new replies.