Support

Account

Home Forums ACF PRO Field labels auto-translated

Solving

Field labels auto-translated

  • When adding a fieldgroup “Meta” with fields “Robots”, “Description” and “Keywords”, after saving, the label “Description” is auto-translated to german “Beschreibung”.

    Workaround, add a space after the label, like “Description “, then it stays as expected (edit: until next save, you have to add the space every time you save).

    Suggestion: Do not auto-translate labels. Edit: Or at least add a custom $domain to line 98 in api/api-field.php like $field[ $s ] = __($field[ $s ], 'acf_label'); or similar.

    WP 3.8.3, ACF PRO 5.0.0, WPML 3.1.6

  • Hi @thomask

    Thanks for the bug report. I’m sure others will have this same issue, so I would like to find a solution which benefits everyone.

    By adding the $domain, does this fix the issue completely?

  • By adding an own domain to __(), the use of the WordPress ‘default’ domain is avoided which tries to translate the labels using e.g. the general strings of admin backend, which is bad.

    With an own domain it would be possible to create a language file (by hand!) for the label translations. An automated tool won’t work here, see also example 2 here.

    Best choice is to remove the __() and to not auto-translate labels.

    If translation plugins like WPML are used, an own fieldgroup for each language has to be added anyway, so the labels can be set as wanted by the user.

  • Hi @thomask

    Thanks for the info.
    The translation has been added to allow other translation plugins such as polylang to work.

    I don’t want to remove the functionality as this will break some sites, but agree that a solution is required for both situations to work correctly.

  • Would suggest a new filter then, pseudocode:

    $translate = apply_filters( 'new_filter', 'acf_default' );
    switch( $translate ) {
    case 'acf_notranslate':
    	// do not use __() at all
    	.. $field[ $s ] ..
    	break;
    case 'acf_default':
    	// use code like now
    	.. __($field[ $s ]) ..
    	break;
    default:
    	// use filter_value as domain
    	.. __($field[ $s ], $translate) ..
    	break;
    }
  • Hi @thomask

    Nice one, I like the logic and will add this to my to-do list

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Field labels auto-translated’ is closed to new replies.