Hi,

Do you know of a way to change the language of the text that is generated by yahoo? So I can translate text like ‘Partly Cloudy’ into my own language?
The same way titles for images can be translated?

Would be great if you could help me out with this one.

Comments

Alex Andrascu’s picture

subscribing. also interested in this feature

klonos’s picture

Did you people try Localization client?

stelmo’s picture

Hello

I made my own translation introducing a function in the file: yahoo-weather-forecast-content.tpl.php, like this:

// $Id: yahoo-weather-forecast-content.tpl.php,v 1.1.2.1 2009/12/01 16:42:25 pl2 Exp $

/**
 * @file
 * Yahoo weather content template.
 */

function translate_current($current){
    switch (strtolower($current)) {
    case "partly cloudy":
        return "Parcialmente Nublado";
        break;
    case "sunny":
        return "Sol";
        break;
    case "clear":
        return "Céu Limpo";
        break;
    }
}

And then changed this lines:

if ($current) :
$curr=translate_current($current)

print t('Actual conditions') : print $curr

endif;

I didn't finished all the translations but I just need to copy the translations i did in the file: yahoo_weather_forecast.inc

I'm using this in my INTRANET.

stelmo’s picture

Here it is the complete function:

function translate_current($current){
switch (strtolower($current)) {
case "tornado":

return "Tornado";

break;

case "tropical storm":

return "Tempestade Tropical";

break;

case "hurricane":

return "Furacão";

break;

case "severe thunderstorms":

return "Relâmpagos";

break;

case "thunderstorms":

return "Trovoada";

break;

case "mixed rain ad snow":

return "Chuva e neve";

break;

case "mixed rain ad sleet":

return "Chuva com neve";

break;

case "mixed snow and sleet":

return "Chuva com neve";

break;

case "freezing drizzle":

return "Chuviscos frios";

break;

case "drizzle":

return"Chuviscos";

break;

case "freezing raing":

return "Chuva fria";

break;

case "showers":

return "Aguaceiros";

break;

case "snow flurries":

return "Flocos de neve";

break;

case "light snow showers":

return "Chuviscos de neve";

break;

case "blowing snow":

return "Neve e vento";

break;
case "partly cloudy":
return "Parcialmente Nublado";

break;
case "mostly sunny":
return "Céu pouco nublado";

break;

case "snow":

return "Neve";

break;

case "hail":

return "Granizo";

break;

case "sleet":

return "Chuviscos";

break;

case "Dust":

return "";

break;

case "Foggy":

return "Nevoeiro";

break;

case "haze":

return "Neblina";

break;

case "smoky":

return "Neblina";

break;

case "blustery":

return"";

break;

case "Windy":

return "Vento forte";

break;

case "cold":

return "Frio";

break;

case "cloudy":

return "Nublado";

break;

case "mostly cloudy (night)":

return "Muito nublado (noite)";

break;

case "mostly cloudy (day)":

return "Muito nublado (dia)";

break;

case "partly cloudy (night)":

return "Parcialmente Nublado (noite)";

break;

case "partly cloudy (day)":

return "Parcialmente Nublado (dia)";

break;

case "clear (night)":

return "Limpo (noite)";

break;

case "sunny":

return "Sol";

break;

case "fair (night)":

return "Agradável (noite)";

break;

case "fair (day)":

return "Agradável (dia)";

break;

case "mixed rain and hail":

return "Chuva e granizo";

break;

case "hot":

return "Calor";

break;

case "isolated thunderstorms":

return "Tempestades Isoladas";

break;

case "scattered thunderstorms":

return "Tempestades dispersas";

break;

case "scattered showers":

return "Aguaceiros dispersos";

break;

case "heavy snow":

return "Neve pesada";

break;

case "scattered snow showers":

return "Queda de neve dispersa";

break;

case "thundershowers":

return "Tempestade";

break;

case "Snow showers":

return "Neve";

break;

case "Not available":

return "Informação indisponivel";

break;
default:
return $current;
break;

}

Marko B’s picture

Almost Everything can be tranlated trough trans. interface. Forecast part variables can't and you also didnt include that part, so forecast (besides labels) is stil on english.