Home Forums Add-ons Flexible Content Field Layouts label translation missing Reply To: Layouts label translation missing

  • Hi @acf-support

    thank you very much, this code snippet solve the problem.
    I did not know about the existance of it.

    But I wish to say that, however, any label that are exposed to the public such as layout label and button label (in flexible content) as well as button label (in repeater field) should be all wrapped into the __() function by default.

    Really, The snippet solve the problem perfectly, but Elliot should consider the suggestion to include even this labels into the acf translation process.

    Anyway I’ve improved the snippet code including other labels that needs translations:

    function my_acf_fix_layout_translate( $field ) {
    	//flexible content
        if( $field['type'] == 'flexible_content' ){
    		//layout labels
    		foreach( $field['layouts'] as $k => $layout ){
                $field['layouts'][$k]['label'] = acf_translate( $field['layouts'][$k]['label'] );
    		//button label
    		$field['button_label'] = acf_translate( $field['button_label'] );
    	if( $field['type'] == 'repeater' ){
    		//button label
    		$field['button_label'] = acf_translate( $field['button_label'] );
        return $field;
    add_filter('acf/translate_field', 'my_acf_fix_layout_translate');

    Thank you very much again.