Support

Account

Forum Replies Created

  • I stumbled upon this topic when trying to translate field label & instructions myself, I registered my fields using the PHP acf_add_local_field_group(); functionality but just as the others in this topic the strings translated using __('yourlabel', 'yourlangaugelocale') weren’t outputted in the locale lang set.

    I couldn’t find any other post about it so for any others having the same issue I managed to resolve the issue by adding a field filter where I utilize the __('yourlabel', 'yourlangaugelocale')functionality again, see example below:

    
    add_filter('acf/load_field', 'translate_acf_fields');
    function translate_acf_fields( $field ) {
     
      // Don't run on acf-field-group page
      if( get_post_type( get_the_ID() ) == 'acf-field-group' ) {
        return $field;
      }
    
      // Translate backend labels/titles/instuctions
      $field['label']        = __( $field['label'], 'Weblenn' );
      $field['instructions'] = __( $field['instructions'], 'Weblenn' );
    
      return $field;
    }
    

    Note: You still need to register the strings in acf_add_local_field_group() to be able to use a tool to create your mo/po files.

Viewing 1 post (of 1 total)