WordPress.org

Support

Support » Plugins and Hacks » Weather Underground » [Plugin: Weather Forecast – WP Wunderground] Weather Forecast – Wunderground

[Plugin: Weather Forecast – WP Wunderground] Weather Forecast – Wunderground

  • This plugin is great, many options for displaing the weather, but is only easily available for English. It would be nice to be able to do as per WP Forecast … hange language in a menu 🙂

    Well, in order to change the language you have to do some coding … So, I would like to translate to portuguese and could not do it. Can anyone help me describing the steps ? Or how to do it. I would be very grateful !

Viewing 15 replies - 1 through 15 (of 15 total)
  • Anything new about translating to another language than English? It could be the top of the plugin to have that opportunity, it is the only thing that is missing, because it is a very good pluging, just missing the opportunity to change to another language. Some advice could be nice. Thanks in advance.

    Best regards
    Spaniole Olsen

    To translate, add to your functions theme file:

    function replace_weather($content) {
        $content = str_replace('Rain', 'Lluvioso', $content);
        $content = str_replace('Storm', 'Tormenta', $content);
        $content = str_replace('Sunny', 'Soleado', $content);
        $content = str_replace('Monday', 'Lunes', $content);
        $content = str_replace('Tuesday', 'Martes', $content);
        return $content;
    }
    add_filter('wp_wunderground_forecast', 'replace_weather');

    As you can notice, I’m using spanish for day names label and the “forecast condition”.
    Check the complete wunderground forecast condition labels here and translate to your own language:

    Good luck translating…

    Hello lozanno

    It was indeed what I needed, thank you very much, works as you described. By the way I did a danish translation.

    Best regards
    Spaniole Olsen

    Plugin Author Zack Katz

    @katzwebdesign

    Hi ibbranco18 and spaniole,
    I’ve been working on a major upgrade to the plugin, and am planning on language support. Could you both email me your translations to info@katzwebservices.com ?

    Thank you, and thanks lozanno for your helpful response.

    Can someone teach me how to add shortcode in the template file?

    This below php code does not work.

    <?php wp_wunderground_forecast(); ?>

    Rgds
    nkkhoo

    Plugin Author Zack Katz

    @katzwebdesign

    You can use echo do_shortcode('[forecast location="Example"]'); in your template.

    Hi all,
    I have also translated the names labels but it is showing a strange problem. I have edited my functions.php to look like this (Danish):
    But the Partly Cloudy is beeing tanslated to Partly Overskyet ?
    I dont get it why it doesnt translate the entire sentence.
    See site here: http://www.buresoebanden.dk/
    Any ideas ??

    function replace_weather($content) {
    $content = str_replace(‘Chance of Flurries’, ‘Mulighed for Sne’, $content);
    $content = str_replace(‘Chance of Rain’, ‘Mulighed for Regn’, $content);
    $content = str_replace(‘Chance of Freezing Rain’, ‘Mulighed for Isslag’, $content);
    $content = str_replace(‘Chance of Sleet’, ‘Mulighed for Slud’, $content);
    $content = str_replace(‘Chance of Snow’, ‘Mulighed for Sne’, $content);
    $content = str_replace(‘Chance of Thunderstorms’, ‘Mulighed for Torden’, $content);
    $content = str_replace(‘Chance of a Thunderstorm’, ‘Mulighed for Torden’, $content);
    $content = str_replace(‘Clear’, ‘Klart vejer’, $content);
    $content = str_replace(‘Cloudy’, ‘Overskyet’, $content);
    $content = str_replace(‘Flurries’, ‘Sne’, $content);
    $content = str_replace(‘Fog’, ‘Tåge’, $content);
    $content = str_replace(‘Haze’, ‘Tåge’, $content);
    $content = str_replace(‘Mostly Cloudy’, ‘Mest Skyet’, $content);
    $content = str_replace(‘Mostly Sunny’, ‘Mest Sol’, $content);
    $content = str_replace(‘Partly Cloudy’, ‘Delvis Skyet’, $content);
    $content = str_replace(‘Partly Sunny’, ‘Delvis Sol’, $content);
    $content = str_replace(‘Freezing Rain’, ‘Isslag’, $content);
    $content = str_replace(‘Rain’, ‘Regn’, $content);
    $content = str_replace(‘Sleet’, ‘Slud’, $content);
    $content = str_replace(‘Sunny’, ‘Sol’, $content);
    $content = str_replace(‘Thunderstorms’, ‘Torden’, $content);
    $content = str_replace(‘Thunderstorm’, ‘Torden’, $content);
    $content = str_replace(‘Unknown’, ‘Ukendt’, $content);
    $content = str_replace(‘Overcast’, ‘Overskyet’, $content);
    $content = str_replace(‘Scattered Clouds’, ‘Lidt Skyet’, $content);
    $content = str_replace(‘Monday’, ‘Mandag’, $content);
    $content = str_replace(‘Tuesday’, ‘Tirsdag’, $content);
    $content = str_replace(‘Wednesday’, ‘Onsdag’, $content);
    $content = str_replace(‘Thursday’, ‘Torsdag’, $content);
    $content = str_replace(‘Friday’, ‘Fredag’, $content);
    $content = str_replace(‘Saturday’, ‘Lordag’, $content);
    $content = str_replace(‘Sunday’, ‘Sondag’, $content);
    return $content;
    }
    add_filter(‘wp_wunderground_forecast’, ‘replace_weather’);

    Plugin Author Zack Katz

    @katzwebdesign

    @psoderlund – You’ll want to have the two-word forecasts before the single word forecasts. Move the “Partly Cloudy” line above the “Cloudy” line, for example. “Cloudy” is being replaced with “Overskyet” before “Partly Cloudy” is being processed.

    Thanks Zack for the quick reply. I made the changes now I just have to whait for the weather to turn something else besides Sunny!!! But I think your fix will do it as some of the other phrases worked fine and they were in the “correct order”.
    So thanks.

    Hello psoderlund

    You could easily get the danish characters æ ø å to behave the right way on the hole www with some HTML symbols (I think!), some examples will follow (I have to do spaces between the letters, or else they will become the letters æ and ø and you can’t see the right symbols to use, so please remove the spaces before use):

    $content = str_replace(‘Fog’, ‘T& a r i n g ;ge’, $content);
    $content = str_replace(‘Haze’, ‘T& a r i n g ;get’, $content);

    $content = str_replace(‘Saturday’, ‘L& # 2 4 8 ;rdag’, $content);
    $content = str_replace(‘Sunday’, ‘S& # 2 4 8 ;ndag’, $content);

    Hi Spaniole,
    I will give your suggestion a try!!
    Very nice if I could get the characters showing. I will post later when I have tested it.

    Thanks guys for helping me out, such a good support community here on WordPress…

    Have a good day.

    Peter 🙂

    Italian translation here.

    Heres the Danish one for all of you…in correct form.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Hy

    what if I need translation for 4 languages? In my case it is en, de, it and hr?

    Any advice

    Sasa

    solved 🙂

    if(qtrans_getLanguage() == ‘it’){
    if (!function_exists(‘replace_weather’)) :
    function replace_weather($content) {
    $content = str_replace(‘Chance of Flurries’, ‘possibile tempesta di neve’, $content);


    }
    add_filter(‘wp_wunderground_forecast’, ‘replace_weather’);
    endif;
    }
    if(qtrans_getLanguage() == ‘de’){
    if (!function_exists(‘replace_weather’)) :
    function replace_weather($content) {
    $content = str_replace(‘Chance of Flurries’, ‘Mögliche Schneeschauer’, $content);


    }
    add_filter(‘wp_wunderground_forecast’, ‘replace_weather’);
    endif;
    }

    and so on 🙂

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: Weather Forecast – WP Wunderground] Weather Forecast – Wunderground’ is closed to new replies.
Skip to toolbar