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

    • Elliot

    • July 16, 2014 at 1:22 pm

    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.

    • Elliot

    • July 30, 2014 at 11:01 am

    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.

    • thomask

    • August 1, 2014 at 1:40 am

    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;
    }
    • Elliot

    • August 6, 2014 at 1:17 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.