Support

Account

Home Forums Backend Issues (wp-admin) Localizing texts when adding fields via theme Reply To: Localizing texts when adding fields via theme

  • I’ve only done translations on a limited basis and always followed examples of what others do. It might be better to see the array that you’re using for creating the field group and how you’ve added the translation function.

    For example, this is part of fields of one field group that I’ve added translations for in the past. The main difference is that I’m not using esc_html__() and instead I’m just using __()

    
    $field_group = array(
    'key' => 'acf_options-page-details',
    'title' => __('Options Page Details', $this->text_domain),
    'fields' => array(
      array(
        'key' => 'field_acf_key_acfop_message',
        'label' => __('Options Page Message', $this->text_domain),
        'name' => '',
        'prefix' => '',
        'type' => 'message',
        'instructions' => '',
        'required' => 0,
        'conditional_logic' => 0,
        'message' => __('Title above is the title that will appear on the page. Enter other details as needed.<br />For more information see the ACF documentation for <a href="http://www.advancedcustomfields.com/resources/acf_add_options_page/" target="_blank">acf_add_options_page()</a> and <a href="http://www.advancedcustomfields.com/resources/acf_add_options_sub_page/" target="_blank">acf_add_options_sub_page()</a>.', $this->text_domain)
      ),
      array(
        'key' => 'field_acf_key_acfop_menu',
        'label' => __('Menu Text', $this->text_domain),
        'name' => '_acfop_menu',
        'prefix' => '',
        'type' => 'text',
        'instructions' => __('Will default to title if left blank.', $this->text_domain),
        'required' => 0,
        'conditional_logic' => 0,
        'default_value' => '',
        'placeholder' => '',
        'prepend' => '',
        'append' => '',
        'maxlength' => '',
        'readonly' => 0,
        'disabled' => 0
      ),
      // field group continues .......