Switch language if the one of visitor browser is not available

dev.xiligroup is being renovated Forums xili-language plugin Switch language if the one of visitor browser is not available

This topic contains 0 replies, has 3 voices, and was last updated by  xiligroup dev 12 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2994

    Anonymous

    are you able to write in php and create a small function ?

    #2996

    Anonymous

    Yes, I’ve tried to hook the function that sets the language through a custom function in my functions.php file but I had errors telling that I was not in OOP anymore (because of the « this « tag of the original function that I’ve copied).

    Basically I was looping through the available languages and if none was found then I returned « it_it » as the current one.

    Thanks for the help

    #2997

    xiligroup dev
    Keymaster

    as readable in code of plugin itself or in multilingual-functions.php in theme named twentyten-xili, you must replace $this by the global $xili_language created when class is instantiated.

    http://multilingual.wpmu.xilione.com/

    function my_function() {
    if ( class_exists('xili_language') ) {
    global $xili_language;

    if (

    for your specific case… give me a little time !

    #3000

    Anonymous

    thanks for your help, hoping to hear from you soon ;-)

    #3002

    Anonymous

    the key filter named ‘choice_of_browsing_language’ for this purpose is called in a function (at around line #1700 in plugin)… and when an external filter is available don’t execute the core function.

    function choice_of_browsing_language() {
    if ( has_filter('choice_of_browsing_language') ) return apply_filters('choice_of_browsing_language');
    ....

    so in your functions.php create your own filter by studying before the current function inside plugin code…

    function edo_choice_of_browsing_language() {
    ...
    /// edo rules
    return $lang_slug;
    }
    add_filter ( 'choice_of_browsing_language', 'edo_choice_of_browsing_language' );

    #3006

    Anonymous

    thanks for your feedback. Just one thing: I have an error saying:

    Warning: Missing argument 2 for apply_filters(), called in /Users/Edoardo/Sites/laletterag.it/wp-content/plugins/xili-language/xili-language.php on line 1721 and defined in /Users/Edoardo/Sites/laletterag.it/wp-includes/plugin.php on line 134

    so I’ve checked around and it seems that apply_filters() has 2 variables and in xili_language.php there is only one. If I put a random variable $hello it works without showing the error.

    from

    if ( has_filter(‘choice_of_browsing_language’) ) return apply_filters(‘choice_of_browsing_language’);

    to

    if ( has_filter(‘choice_of_browsing_language’) ) return apply_filters(‘choice_of_browsing_language’, $hello);

    Is it me or there is a minor bug?

    #3007

    xiligroup dev
    Keymaster

    Thanks,

    this warning occur on some server (php ?) need one arg by default… next version 2.3.1 will fixe this message.. by including a  ».

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.