Plugin Directory

Changeset 1413020


Ignore:
Timestamp:
05/09/2016 01:59:23 PM (10 years ago)
Author:
ishaijaffe
Message:

don't override website original locale

Location:
bablic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bablic/tags/2.0/Bablic.php

    r1409632 r1413020  
    109109        return $options['orig'];
    110110    }
    111     function get_locale(){
     111    function get_locale($lang){
     112        $options = $this->optionsGetOptions();
     113        if(!$lang)
     114            $lang = $options['orig'];
     115        if(is_admin())
     116            return $lang;
    112117        $header = (isset($_SERVER['HTTP_BABLIC_LOCALE']) ? $_SERVER['HTTP_BABLIC_LOCALE'] : null);
     118        $bablic_locale = '';
    113119        if($header){
    114             return $header;
     120            $bablic_locale = $header;
    115121        }
    116122        $url = $_SERVER['REQUEST_URI'];
    117         return $this->get_locale_from_url($url);
     123        $bablic_locale = $this->get_locale_from_url($url);
     124        if(!$bablic_locale || $bablic_locale == $options['orig'])
     125            return $lang;
     126        return $bablic_locale;
    118127    }
    119128   
  • bablic/trunk/Bablic.php

    r1409632 r1413020  
    109109        return $options['orig'];
    110110    }
    111     function get_locale(){
     111    function get_locale($lang){
     112        $options = $this->optionsGetOptions();
     113        if(!$lang)
     114            $lang = $options['orig'];
     115        if(is_admin())
     116            return $lang;
    112117        $header = (isset($_SERVER['HTTP_BABLIC_LOCALE']) ? $_SERVER['HTTP_BABLIC_LOCALE'] : null);
     118        $bablic_locale = '';
    113119        if($header){
    114             return $header;
     120            $bablic_locale = $header;
    115121        }
    116122        $url = $_SERVER['REQUEST_URI'];
    117         return $this->get_locale_from_url($url);
     123        $bablic_locale = $this->get_locale_from_url($url);
     124        if(!$bablic_locale || $bablic_locale == $options['orig'])
     125            return $lang;
     126        return $bablic_locale;
    118127    }
    119128   
Note: See TracChangeset for help on using the changeset viewer.