Forums

Is it possible to translate results from wp-weather? (5 posts)

  1. bezbeli
    Member
    Posted 2 years ago #

    Is it possible to translate results in some other language? Maybe using Google translate API or something like that? Just an idea, definitely would be useful.

    http://wordpress.org/extend/plugins/wp-weather/

  2. mattbta
    Member
    Posted 2 years ago #

    The plugin has translation available. You'll have to create a translation file specific to your locale and upload it to plugins/wp-weather/localization

    There should be an example in that directory for you to follow.

  3. bezbeli
    Member
    Posted 2 years ago #

    Thank you very much
    BTW great plug-in :-) is there a way to insert widget in custom sidebar, short-code doesn't work?

  4. mattbta
    Member
    Posted 2 years ago #

    <?php weather_display(); ?>

  5. CrystalBlood
    Member
    Posted 2 years ago #

    Hi Matt! i was striving with the plugin last days, and i wanna share a piece of code that may help to the translation issue, i mean especifically in the date when is pulled out from the XML file, i try this and work fine for me.
    I replace this:
    $htmlstring .= __('Forecast for ', 'wp-weather').$day_forecast->day[t] . ', ' . $day_forecast->day[dt].'">';
    for this:
    $htmlstring .= __('Forecast for ', 'wp-weather'). date_i18n('l, j F', strtotime($day_forecast->lsup)) .'">';

    this way, the date get localized according to the wordpress language installed.

    But, dealing with the current conditions code was something else, so i made an array with the values translated and use the "icon" as an index for the array, accesing like this:

    $htmlstring .= '<br />'.$mensajes[(int)$xml->cc->icon].'<br />';

    I was wondering if you know any other "easy" way to do this, through some parameter, for the xoap.weather.com URL, or the forecastrss URL maybe.

    Check out the modifications i made:
    (Spanish) http://crystalblood.wordpress.com/2010/05/07/plugin-wp-weather-en-espanol-para-el-wordpress-mediante-algunos-tweakshacks-weather-com/

    Best Regards!

Topic Closed

This topic has been closed to new replies.

About this Topic