Support » Plugin: Admin in English » [Plugin: Admin in English] Awesome Plugin but also forces the login to english

Viewing 2 replies - 1 through 2 (of 2 total)
  • I found a sort of work around if a genuine solution isn’t discovered.
    My Site was downloaded in French, and normally I used this plugin as advertised, just for the admin. The problem was that it also caused the login form to go to english as well. To avoid the french readers from being forced to log in on a form they may or may not understand, I decided to just deactivate the plugin if I wasn’t editing or making changes. Then when I needed to use the admin, reactivate and put the site in maintenance mode during the work. I would much prefer a more technical fix, but this will work if nothing can be found.

    I found the technical fix. Version: 1.1 changed the wp login.php
    I modified the plugin to the following.

    [ Moderator Note: Please post code or markup snippets between backticks or
    use the code button. ]

    <?php
    /*
    Plugin Name: Admin in English
    Plugin URI: http://wordpress.org/extend/plugins/admin-in-english/
    Description: Lets you have your backend administration panel in English, even if the rest of your blog is translated into another language.
    Version: 1.2
    Author: Nikolay Bachiyski
    Author URI: http://nikolay.bg/
    Tags: translation, translations, i18n, admin, english, localization, backend
    */
    
    function admin_in_english_locale( $locale ) {
    	if ( admin_in_english_should_use_english() ) {
    		return 'en_US';
    	}
    	return $locale;
    }
    add_filter( 'locale', 'admin_in_english_locale' );
    
    function admin_in_english_should_use_english() {
    	// frontend AJAX calls are mistakend for admin calls, because the endpoint is wp-admin/admin-ajax.php
    	return admin_in_english_is_admin() && !admin_in_english_is_frontend_ajax();
    }
    
    function admin_in_english_is_admin() {
    	return
    		is_admin() || admin_in_english_is_tiny_mce() || admin_in_english_is_login_page();
    }
    
    function admin_in_english_is_frontend_ajax() {
    	return defined( 'DOING_AJAX' ) && DOING_AJAX && false === strpos( wp_get_referer(), '/wp-admin/' );
    }
    
    function admin_in_english_is_tiny_mce() {
    	return false !== strpos( $_SERVER['REQUEST_URI'], '/wp-includes/js/tinymce/');
    }
    
    function admin_in_english_is_login_page() {
    	return false;
    }

    Changelogs are great!!
    Now the front is french…. the login is french…. and the admin is english thanks to this awesome plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Admin in English] Awesome Plugin but also forces the login to english’ is closed to new replies.