• I have made two languages for backend and frontend. For frontend is default var “WPLANG” and for backend will be “admin_WPLANG”.

    I have made options in woocommerce general settings tab. There is two language options for backend and fronted. When I select and save the option its not changing the language, I must to reload page again … What do I need that on option save it could change the language in backend?

    My code:

    add_action( 'woocommerce_update_options_general', 'update_settings_tabas', 10);
    function update_settings_tabas(){
        update_option('admin_WPLANG',$_POST['admin_WPLANG']);
    }
    
    add_filter( 'locale', 'change_language_backend', 99);
    
    function change_language_backend( $locale ) {
       $language = get_option('admin_WPLANG');
       if(is_admin()){
           return $language;
       }else{
           return $locale;
       }
    }

    https://wordpress.org/plugins/woocommerce/

  • The topic ‘Woocommerce different language on backend’ is closed to new replies.