WordPress.org

Ready to get started?Download WordPress

Forums

Admin in English
[resolved] Awesome Plugin but also forces the login to english (3 posts)

  1. Foglifter
    Member
    Posted 1 year ago #

    I absolutely love this plugin. It simplified my life. Just wish I could block the plugin from changing the wordpress login form to english. Maybe a setting to choose. Anyway Thanks for this plugin.

    http://wordpress.org/extend/plugins/admin-in-english/

  2. Foglifter
    Member
    Posted 1 year ago #

    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.

  3. Foglifter
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags