• Resolved nickysheen

    (@nickysheen)


    Marсin, thanks for the plugin. I am having a problem translating advanced custom field labels. I would be very grateful if you can tell me what I’m doing wrong.

    To translate labels from Russian to Portuguese I register fields in functions.php

    if ( function_exists( 'acf_add_local_field_group' ) ) :
    	acf_add_local_field_group(
    		array(
    			'key'    => 'group_5ff5e76e3bbba',
    			'title'  => __( 'ПРЕДЛОЖЕНИЕ', 'our-portugal' ),
    			'fields' => array(
    				array(
    					'key'     => 'field_5ff5e780f30ef',
    					'label'   => __( 'Тип объекта:', 'our-portugal' ),
    					'name'    => 'property_type',
    					'type'    => 'select',
    					'choices' => array(
    						'appartment' => __( 'квартира', 'our-portugal' ),
    						'house'      => __( 'дом', 'our-portugal' ),
    						'townhose'   => __( 'таунхаус', 'our-portugal' ),
    						'duplex'     => __( 'дуплекс', 'our-portugal' ),
    					),
    					'default_value' => 'appartment',
    					'return_format' => 'label',
    				),
    			),
    			'location'              => array(
    				array(
    					array(
    						'param'    => 'post_type',
    						'operator' => '==',
    						'value'    => 'realty',
    					),
    				),
    			),
    		)
    	);
    endif;

    `

    The required strings appear in the “String translations” section. But, when I add a translation and change the user language to Portuguese, the form containing all my fields still remains in Russian. Any idea why this is happening? Thank you in advance

    • This topic was modified 4 years ago by nickysheen.
    • This topic was modified 4 years ago by nickysheen.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    Hi,
    the problem is only when you use Cyrillic chars?

    Regards,

    Thread Starter nickysheen

    (@nickysheen)

    I tried to write the source labels in English. Unfortunately, this did not help.

    Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    Maybe the problem is with acf_add_local_field_group function:
    Documentation:
    acf_add_local_field_group($field_group) – Adds a field group to the local cache
    https://www.advancedcustomfields.com/resources/register-fields-via-php/

    This “local cache” maybe remembers the text once and does not refresh it?

    Thread Starter nickysheen

    (@nickysheen)

    I cleaned the cache in all available ways. And it didn’t help. I think there is no point in distracting you and wasting your time on this problem. Thank you for participating.

    Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    OK, if you find a solution, let me know! ??
    Regards,

    Thread Starter nickysheen

    (@nickysheen)

    sure. good luck

    Thread Starter nickysheen

    (@nickysheen)

    Marсin, I’m sorry to return to the topic. But I found that not only strings for ACF are not translated, but in general any strings from my theme. Maybe you will have some guesses about the reasons.

    My theme is based on the Timber. But there are strings for translation only in functions.php (I need to translate one form into Portuguese).

    
    public function register_post_types() {
      $realty_labels = array(
        'name' => _x( 'Real Estate', 'Post Type General Name', 'our-portugal' ),
        'singular_name' => _x('Property', 'Post Type Singular Name', 'our-portugal' ),
        'menu_name'     => __('Real Estate', 'our-portugal'),
        // etc
      );
    

    Plus several ACF arrays, which also need to be translated (I wrote about them above).

    The style.css contains a text domain:

    
    Text Domain:  our-portugal
    

    I tried using Polylang functions in functions.php but it didn’t help. True, there is a possibility that I have used the wrong functions.

    Screenshot

    Nothing comes to mind?

    • This reply was modified 3 years, 11 months ago by nickysheen.
    Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    Could you paste a working code snippet?
    I will test it on a local wordpress instance.

    Thread Starter nickysheen

    (@nickysheen)

    Have a look at functions.php. I have deleted the ACF objects there so far. But the strings that need translation are used in the register_post_types function.

    It’s enough?

    Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘ACF (Advanced Custom Field) Translation’ is closed to new replies.