Switch language if the one of visitor browser is not available

dev.xiligroup est en travaux Forums xili-language plugin Switch language if the one of visitor browser is not available

Ce sujet contient 0 réponses et 3 voix, et a été mis à jour par  xiligroup dev il y a Il y a 13 ans.

Visualisation du message 7 (1 sur 7, 7 au total)
  • Auteur
    Articles
  • #2994

    Anonyme

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

    #2996

    Anonyme

    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

    Anonyme

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

    #3002

    Anonyme

    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

    Anonyme

    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  ».

Visualisation du message 7 (1 sur 7, 7 au total)

Vous devez être connecté pour répondre à ce sujet.