0

I created a plugin to translate text of wp-login.php page into Arabic, every thing translated well except Back to which appear at the bottom of login form, I can't catch it to translate into Arabic

My site name called Foodonia, and I want to translate ← Back to Foodonia to العودة إلى فودنيا , I tried each one of below:

← Back to Foodonia
Back to
Back to Foodonia
← Back to Foodonia
← Back to

here is my code

function my_custom_login_label( $translated_text, $text, $domain ) {
    if (in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) )) { 
        if ($translated_text === 'Username') $translated_text = 'اسم المستخدم';
        if ($translated_text === 'Password') $translated_text = 'كلمة المرور';
        if ($translated_text === '← Back to Foodonia') $translated_text = '← العودة إلى فودنيا';

    return $translated_text;
  }
}
add_filter( 'gettext', 'my_custom_login_label', 20, 3 );

My site URL: http://foodonia.com (changing language between English and Arabic using site nav menu will effect the login language)

1 Answer 1

2

The correct string is '← Back to %s'. The site name is inserted after the translation.

See the function login_footer() for details.

3
  • @ toscho Thank you very much, It works. Just I wonder does wordpress consider %s as HTML? Oct 13, 2013 at 15:21
  • @usamasulaiman The %s is a placeholder, which is parsed by sprintf().
    – fuxia
    Oct 15, 2013 at 13:39
  • The %s is a "printf format" placeholder for a string. The translation functions let code pass a value (in this case the blog name) which will get put in place of %s.
    – Dave Ross
    Oct 15, 2013 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.