• Resolved nelero

    (@nelero)


    Hi,
    widget is not translated when used on wordpress with several languages.

    My language in general settings is French
    i use WPML and i have 2 languages : French (default) and English which is used for /en/ … urls
    I created two widgets in “Weather” menu. One for French, One for english.
    But when the widget is displayed on english page, it is still in french.
    So the widget doesn’t take care of the language defined by WPML. (constant ICL_LANGUAGE_CODE for example, which carries the language : fr for french, en for english, …)

    I tried to use :

    <?php if(ICL_LANGUAGE_CODE=='en'){
    				echo do_shortcode('[wpc-weather id="8883"]');
    			} else {
    				echo do_shortcode('[wpc-weather id="6132"]'); 
    			} ?>
    			

    in my theme, but still in french for both English and French website

    Can we fix this in order to fix the widget language to target the WPML language?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi,
    yes we are still investigating this problem.

    Thread Starter nelero

    (@nelero)

    So i solved it in modifying Wp-cloudy.
    When ajax call is made, we lost the current language.
    So in wpcloudy.php file, i added the querystring variable lang.
    Line 105 :
    wp_localize_script( 'wpc-ajax', 'wpcAjax', admin_url( 'admin-ajax.php' ) . "?lang=" . substr(get_locale(),0,2) );

    and optionaly, line 131 :
    wp_localize_script( 'wpc-ajax', 'wpcAjax', admin_url( 'admin-ajax.php' ) . "?lang=". substr(get_locale(),0,2) );

    And it works like a charm.
    get_locale() function returns the current language and is well overriden by WPML !

    Can you merge this fix in the next release ?

    Thanks

    • This reply was modified 7 years, 7 months ago by nelero.
    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi,
    thank you for sharing this fix.
    After many tests, it seems that everything is working as expected.
    I have include it in WP Cloudy 3.9.1

    ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Widget doesn’t use WPML language config’ is closed to new replies.