Language
-
Hi there. The plugin works perfect but… I want to be able to get in Spanish or other language the text, as example: “Partly Cloudy” should be to me “Parcialmente Nublado”
I don’t want to touch the core files, so … is there a PO or language file?
Thanks in advance!
-
Hi!
Just had this problem myself recently. You should put some code in wonderground.php file, but it’s nothing complicated.
AFTER THE LINE: $label = $this->format_date($date, $todaylabel, $datelabel);
AND BEFORE THE LINE: $tablehead .= “\n\t\t\t\t\t\t\t”.'<th scope=”col” width=”‘.$colwidth.’%” align=”‘.$align.'”>’.$label.'</th>’;PUT THIS CODE:
if ( $label == ‘Sunday’ ) { $label = ‘Nedjelja’; }
else if ( $label == ‘Monday’ ) { $label = ‘Ponedjeljak’; }
else if ( $label == ‘Tuesday’ ) { $label = ‘Utorak’; }
else if ( $label == ‘Wednesday’ ) { $label = ‘Srijeda’; }
else if ( $label == ‘Thursday’ ) { $label = ‘?etvrtak’; }
else if ( $label == ‘Friday’ ) { $label = ‘Petak’; }
else if ( $label == ‘Saturday’ ) { $label = ‘Subota’; }if ( $conditions == ‘Clear’ ) { $conditions = ‘Vedro’; }
else if ( $conditions == ‘Chance of Snow’ ) { $conditions = ‘Mogu? snijeg’; }
else if ( $conditions == ‘Chance of Rain’ ) { $conditions = ‘Mogu?a ki?a’; }
else if ( $conditions == ‘Chance of Freezing Rain’ ) { $conditions = ‘Mogu?a ledena ki?a’; }
else if ( $conditions == ‘Chance of Sleet’ ) { $conditions = ‘Mogu?a susnje?ica’; }
else if ( $conditions == ‘Chance of Thunderstorms’ ) { $conditions = ‘Mogu?nost grmljavine’; }
else if ( $conditions == ‘Cloudy’ ) { $conditions = ‘Obla?no’; }
else if ( $conditions == ‘Flurries’ ) { $conditions = ‘Vjetrovito’; }
else if ( $conditions == ‘Fog’ ) { $conditions = ‘Magla’; }
else if ( $conditions == ‘Freezing Rain’ ) { $conditions = ‘Ledena ki?a’; }
else if ( $conditions == ‘Haze’ ) { $conditions = ‘Sumaglica’; }
else if ( $conditions == ‘Mostly Cloudy’ ) { $conditions = ‘Uglavnom obla?no’; }
else if ( $conditions == ‘Mostly Sunny’ ) { $conditions = ‘Uglavnom sun?ano’; }
else if ( $conditions == ‘Overcast’ ) { $conditions = ‘Obla?no’; }
else if ( $conditions == ‘Partly Cloudy’ ) { $conditions = ‘Djelomi?no obla?no’; }
else if ( $conditions == ‘Partly Sunny’ ) { $conditions = ‘Djelomi?no sun?ano’; }
else if ( $conditions == ‘Rain’ ) { $conditions = ‘Ki?a’; }
else if ( $conditions == ‘Scattered Clouds’ ) { $conditions = ‘Mjestimi?no obla?no’; }
else if ( $conditions == ‘Sleet’ ) { $conditions = ‘Susnje?ica’; }
else if ( $conditions == ‘Snow’ ) { $conditions = ‘Snijeg’; }
else if ( $conditions == ‘Sunny’ ) { $conditions = ‘Sun?ano’; }
else if ( $conditions == ‘Thunderstorms’ ) { $conditions = ‘Grmljavina’; }
else if ( $conditions == ‘Thunderstorm’ ) { $conditions = ‘Grmljavina’; }
else if ( $conditions == ‘Unknown’ ) { $conditions = ‘Nepoznato’; }This should be all values. Translate it to your language and it should do the trick. This translation is for croatian.
Hope this helps ??
Best,
MarkoAca esta para ESPA?OL: Acepto modificaciones!
if ( $label == ‘Sunday’ ) { $label = ‘Domingo’; }
else if ( $label == ‘Monday’ ) { $label = ‘Lunes’; }
else if ( $label == ‘Tuesday’ ) { $label = ‘Martes’; }
else if ( $label == ‘Wednesday’ ) { $label = ‘Miercoles’; }
else if ( $label == ‘Thursday’ ) { $label = ‘Jueves’; }
else if ( $label == ‘Friday’ ) { $label = ‘Viernes’; }
else if ( $label == ‘Saturday’ ) { $label = ‘Sabado’; }if ( $conditions == ‘Clear’ ) { $conditions = ‘Despejado’; }
else if ( $conditions == ‘Chance of Snow’ ) { $conditions = ‘Probabilidad de Nieve’; }
else if ( $conditions == ‘Chance of Rain’ ) { $conditions = ‘Probabilidad de Lluvia’; }
else if ( $conditions == ‘Chance of Freezing Rain’ ) { $conditions = ‘Probabilidad de Lluvia helada’; }
else if ( $conditions == ‘Chance of Sleet’ ) { $conditions = ‘Probabilidad de AguaNieve’; }
else if ( $conditions == ‘Chance of Thunderstorms’ ) { $conditions = ‘Probabilidad de Tormenta’; }
else if ( $conditions == ‘Cloudy’ ) { $conditions = ‘Nublado’; }
else if ( $conditions == ‘Flurries’ ) { $conditions = ‘Nieve suave’; }
else if ( $conditions == ‘Fog’ ) { $conditions = ‘Niebla’; }
else if ( $conditions == ‘Freezing Rain’ ) { $conditions = ‘Lluvia helada’; }
else if ( $conditions == ‘Haze’ ) { $conditions = ‘Neblina’; }
else if ( $conditions == ‘Mostly Cloudy’ ) { $conditions = ‘Mayormente nublado’; }
else if ( $conditions == ‘Mostly Sunny’ ) { $conditions = ‘Mayormente Soleado’; }
else if ( $conditions == ‘Overcast’ ) { $conditions = ‘Nublado con poca visibilidad’; }
else if ( $conditions == ‘Partly Cloudy’ ) { $conditions = ‘Parcialmente nublado’; }
else if ( $conditions == ‘Partly Sunny’ ) { $conditions = ‘Parcialmente Soleado’; }
else if ( $conditions == ‘Rain’ ) { $conditions = ‘Lluvia’; }
else if ( $conditions == ‘Scattered Clouds’ ) { $conditions = ‘Nubes Dispersas’; }
else if ( $conditions == ‘Sleet’ ) { $conditions = ‘Aguanieve’; }
else if ( $conditions == ‘Snow’ ) { $conditions = ‘Nieve’; }
else if ( $conditions == ‘Sunny’ ) { $conditions = ‘Soleado’; }
else if ( $conditions == ‘Thunderstorms’ ) { $conditions = ‘Tormentas electricas’; }
else if ( $conditions == ‘Thunderstorm’ ) { $conditions = ‘Tormenta Eléctrica’; }
else if ( $conditions == ‘Unknown’ ) { $conditions = ‘Desconocido’; }I post the translation without testing … and is not working ??
——————
Edit: Sorry but it worked like a charm, you only have also to disable in options “Cache forecast results”
Thanks!!!Thanks Marko for this solution.
To help others, below is a quick and dirty translation into Portuguese. Feel free to modify
if ( $label == ‘Sunday’ ) { $label = ‘Domingo’; }
else if ( $label == ‘Monday’ ) { $label = ‘Segunda’; }
else if ( $label == ‘Tuesday’ ) { $label = ‘Ter?a’; }
else if ( $label == ‘Wednesday’ ) { $label = ‘Quarta’; }
else if ( $label == ‘Thursday’ ) { $label = ‘Quinta’; }
else if ( $label == ‘Friday’ ) { $label = ‘Sexta’; }
else if ( $label == ‘Saturday’ ) { $label = ‘Sábado’; }if ( $conditions == ‘Clear’ ) { $conditions = ‘Claro’; }
else if ( $conditions == ‘Chance of Snow’ ) { $conditions = ‘Pode nevar’; }
else if ( $conditions == ‘Chance of Rain’ ) { $conditions = ‘Pode chover’; }
else if ( $conditions == ‘Chance of Freezing Rain’ ) { $conditions = ‘Pode gear’; }
else if ( $conditions == ‘Chance of Sleet’ ) { $conditions = ‘Pode nevar com chuva’; }
else if ( $conditions == ‘Chance of Thunderstorms’ ) { $conditions = ‘Temporal’; }
else if ( $conditions == ‘Cloudy’ ) { $conditions = ‘Nublado’; }
else if ( $conditions == ‘Flurries’ ) { $conditions = ‘Flurries’; }
else if ( $conditions == ‘Fog’ ) { $conditions = ‘Fog’; }
else if ( $conditions == ‘Freezing Rain’ ) { $conditions = ‘Chuva de granizo’; }
else if ( $conditions == ‘Haze’ ) { $conditions = ‘Neblina’; }
else if ( $conditions == ‘Mostly Cloudy’ ) { $conditions = ‘Nublado’; }
else if ( $conditions == ‘Mostly Sunny’ ) { $conditions = ‘Sol’; }
else if ( $conditions == ‘Overcast’ ) { $conditions = ‘Nublado’; }
else if ( $conditions == ‘Partly Cloudy’ ) { $conditions = ‘Parcialmente nublado’; }
else if ( $conditions == ‘Partly Sunny’ ) { $conditions = ‘Parcialmente ensolarado’; }
else if ( $conditions == ‘Rain’ ) { $conditions = ‘Chuva’; }
else if ( $conditions == ‘Scattered Clouds’ ) { $conditions = ‘Nuvens escassas’; }
else if ( $conditions == ‘Sleet’ ) { $conditions = ‘Neve com chuva’; }
else if ( $conditions == ‘Snow’ ) { $conditions = ‘Neve’; }
else if ( $conditions == ‘Sunny’ ) { $conditions = ‘Sol’; }
else if ( $conditions == ‘Thunderstorms’ ) { $conditions = ‘Temporais’; }
else if ( $conditions == ‘Thunderstorm’ ) { $conditions = ‘Temporal’; }
else if ( $conditions == ‘Unknown’ ) { $conditions = ‘Desconhecido’; }There was a missing field in the translation (discovered thanks to the nice Lille weather ?? – “Chance of a Thunderstorm”
Here is for the french translation:
if ( $label == 'Sunday' ) { $label = 'Dimanche'; } else if ( $label == 'Monday' ) { $label = 'Lundi'; } else if ( $label == 'Tuesday' ) { $label = 'Mardi'; } else if ( $label == 'Wednesday' ) { $label = 'Mercredi'; } else if ( $label == 'Thursday' ) { $label = 'Jeudi'; } else if ( $label == 'Friday' ) { $label = 'Vendredi'; } else if ( $label == 'Saturday' ) { $label = 'Samedi'; } if ( $conditions == 'Clear' ) { $conditions = 'Dégagé'; } else if ( $conditions == 'Chance of Snow' ) { $conditions = 'Risques de neige'; } else if ( $conditions == 'Chance of Rain' ) { $conditions = 'Risques de pluie'; } else if ( $conditions == 'Chance of Freezing Rain' ) { $conditions = 'Risques de pluie vergla?ante'; } else if ( $conditions == 'Chance of Sleet' ) { $conditions = 'Risques de neige fondue'; } else if ( $conditions == 'Chance of a Thunderstorm' ) { $conditions = 'Risques d orage'; } else if ( $conditions == 'Chance of Thunderstorms' ) { $conditions = 'Risques d orages'; } else if ( $conditions == 'Cloudy' ) { $conditions = 'Nuageux'; } else if ( $conditions == 'Flurries' ) { $conditions = 'Rafales de vent'; } else if ( $conditions == 'Fog' ) { $conditions = 'Brouillard'; } else if ( $conditions == 'Freezing Rain' ) { $conditions = 'Pluie vergla?ante'; } else if ( $conditions == 'Haze' ) { $conditions = 'Brumeux'; } else if ( $conditions == 'Mostly Cloudy' ) { $conditions = 'Principalement nuageux'; } else if ( $conditions == 'Mostly Sunny' ) { $conditions = 'Principalement ensoleillé'; } else if ( $conditions == 'Overcast' ) { $conditions = 'Couvert'; } else if ( $conditions == 'Partly Cloudy' ) { $conditions = 'Partiellement nuageux'; } else if ( $conditions == 'Partly Sunny' ) { $conditions = 'Partiellement ensoleillé'; } else if ( $conditions == 'Rain' ) { $conditions = 'Pluie'; } else if ( $conditions == 'Scattered Clouds' ) { $conditions = 'Nuages dispersés'; } else if ( $conditions == 'Sleet' ) { $conditions = 'Neige fondue'; } else if ( $conditions == 'Snow' ) { $conditions = 'Neige'; } else if ( $conditions == 'Sunny' ) { $conditions = 'Ensoleillé'; } else if ( $conditions == 'Thunderstorms' ) { $conditions = 'Orages'; } else if ( $conditions == 'Thunderstorm' ) { $conditions = 'Orage'; } else if ( $conditions == 'Unknown' ) { $conditions = 'Inconnu'; }
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Hi all!
I add also finnish translation to use in all projects.
Thanks for this plugin, it looks great and is easy to use.
AFTER THE LINE: $label = $this->format_date($date, $todaylabel, $datelabel);
AND BEFORE THE LINE: $tablehead .= “\n\t\t\t\t\t\t\t”.'<th scope=”col” width=”‘.$colwidth.’%” align=”‘.$align.'”>’.$label.'</th>’;
PUT THIS CODE:
if ( $label == ‘Sunday’ ) { $label = ‘Sunnuntai’; }
else if ( $label == ‘Monday’ ) { $label = ‘Maanantai’; }
else if ( $label == ‘Tuesday’ ) { $label = ‘Tiistai’; }
else if ( $label == ‘Wednesday’ ) { $label = ‘Keskiviikko’; }
else if ( $label == ‘Thursday’ ) { $label = ‘Torstai’; }
else if ( $label == ‘Friday’ ) { $label = ‘Perjantai’; }
else if ( $label == ‘Saturday’ ) { $label = ‘Lauantai’; }
if ( $conditions == ‘Clear’ ) { $conditions = ‘Selke??’; }
else if ( $conditions == ‘Chance of Snow’ ) { $conditions = ‘Mahdollisesti lumisade’; }
else if ( $conditions == ‘Chance of Rain’ ) { $conditions = ‘Mahdollisesti sadetta’; }
else if ( $conditions == ‘Chance of Freezing Rain’ ) { $conditions = ‘Mahdollisesti alij??htynytt? vett?’; }
else if ( $conditions == ‘Chance of Sleet’ ) { $conditions = ‘Mahdollisesti r?nt??’; }
else if ( $conditions == ‘Chance of Thunderstorms’ ) { $conditions = ‘Mahdollisesti ukkoskuuroja’; }
else if ( $conditions == ‘Cloudy’ ) { $conditions = ‘Pilvist?’; }
else if ( $conditions == ‘Flurries’ ) { $conditions = ‘Lumikuuroja’; }
else if ( $conditions == ‘Fog’ ) { $conditions = ‘Sumua’; }
else if ( $conditions == ‘Freezing Rain’ ) { $conditions = ‘J??t?v? tihku’; }
else if ( $conditions == ‘Haze’ ) { $conditions = ‘Usva’; }
else if ( $conditions == ‘Mostly Cloudy’ ) { $conditions = ‘Pilvist?’; }
else if ( $conditions == ‘Mostly Sunny’ ) { $conditions = ‘Aurinkoista’; }
else if ( $conditions == ‘Overcast’ ) { $conditions = ‘Pilvist?’; }
else if ( $conditions == ‘Partly Cloudy’ ) { $conditions = ‘Osittain pilvist?’; }
else if ( $conditions == ‘Partly Sunny’ ) { $conditions = ‘Osittain aurinkoista’; }
else if ( $conditions == ‘Rain’ ) { $conditions = ‘Sadetta’; }
else if ( $conditions == ‘Scattered Clouds’ ) { $conditions = ‘Hajanaisia pilvi?’; }
else if ( $conditions == ‘Sleet’ ) { $conditions = ‘R?nt??’; }
else if ( $conditions == ‘Snow’ ) { $conditions = ‘Lunta’; }
else if ( $conditions == ‘Sunny’ ) { $conditions = ‘Aurinkoista’; }
else if ( $conditions == ‘Thunderstorms’ ) { $conditions = ‘Ukkostaa’; }
else if ( $conditions == ‘Thunderstorm’ ) { $conditions = ‘Ukkosta’; }
else if ( $conditions == ‘Unknown’ ) { $conditions = ‘Tuntematon’; }Is there a solution to add a conditional language recognition in case website is multilingual?
For example to use like this (which I tried for multilingual 404 error message, with polylang plugin.):<?php $jez=pll_current_language(); switch ($jez) { case "en": echo "EN 404"; break; case "hr": echo "HR 404"; break; case "de": echo "DE 404"; break; case "it": echo "IT 404"; break; }?>
Just remove echo statement with set of commands for required language. Or maybe eve rewrite code to use nested switch? I will try this tomorrow. Thanks to the author for the solution.
If you use WPML, you can do like this:
Even without WPML, you can still copy the code for spanish and german translation.
Feel free to modify
if (ICL_LANGUAGE_CODE == 'es') { if ( $label == 'Sunday' ) { $label = 'Domingo'; } else if ( $label == 'Monday' ) { $label = 'Lunes'; } else if ( $label == 'Tuesday' ) { $label = 'Martes'; } else if ( $label == 'Wednesday' ) { $label = 'Miércoles'; } else if ( $label == 'Thursday' ) { $label = 'Jueves'; } else if ( $label == 'Friday' ) { $label = 'Viernes'; } else if ( $label == 'Saturday' ) { $label = 'Sábado'; } if ( $conditions == 'Clear' ) { $conditions = 'Despejado'; } else if ( $conditions == 'Chance of Snow' ) { $conditions = 'Probabilidad de Nieve'; } else if ( $conditions == 'Chance of Rain' ) { $conditions = 'Probabilidad de Lluvia'; } else if ( $conditions == 'Chance of Freezing Rain' ) { $conditions = 'Probabilidad de Lluvia helada'; } else if ( $conditions == 'Chance of Sleet' ) { $conditions = 'Probabilidad de AguaNieve'; } else if ( $conditions == 'Chance of a Thunderstorm' ) { $conditions = 'Probabilidad de Tormenta'; } else if ( $conditions == 'Chance of Thunderstorms' ) { $conditions = 'Probabilidad de Tormentas'; } else if ( $conditions == 'Cloudy' ) { $conditions = 'Nublado'; } else if ( $conditions == 'Flurries' ) { $conditions = 'Nieve suave'; } else if ( $conditions == 'Fog' ) { $conditions = 'Niebla'; } else if ( $conditions == 'Freezing Rain' ) { $conditions = 'Lluvia helada'; } else if ( $conditions == 'Haze' ) { $conditions = 'Neblina'; } else if ( $conditions == 'Mostly Cloudy' ) { $conditions = 'Mayormente nublado'; } else if ( $conditions == 'Mostly Sunny' ) { $conditions = 'Mayormente Soleado'; } else if ( $conditions == 'Overcast' ) { $conditions = 'Nublado con poca visibilidad'; } else if ( $conditions == 'Partly Cloudy' ) { $conditions = 'Parcialmente nublado'; } else if ( $conditions == 'Partly Sunny' ) { $conditions = 'Parcialmente Soleado'; } else if ( $conditions == 'Rain' ) { $conditions = 'Lluvia'; } else if ( $conditions == 'Scattered Clouds' ) { $conditions = 'Nubes Dispersas'; } else if ( $conditions == 'Sleet' ) { $conditions = 'Aguanieve'; } else if ( $conditions == 'Snow' ) { $conditions = 'Nieve'; } else if ( $conditions == 'Sunny' ) { $conditions = 'Soleado'; } else if ( $conditions == 'Thunderstorms' ) { $conditions = 'Tormentas Eléctricas'; } else if ( $conditions == 'Thunderstorm' ) { $conditions = 'Tormenta Eléctrica'; } else if ( $conditions == 'Unknown' ) { $conditions = 'Desconocido'; } } else if (ICL_LANGUAGE_CODE == 'de') { if ( $label == 'Sunday' ) { $label = 'Sonntag'; } else if ( $label == 'Monday' ) { $label = 'Montag'; } else if ( $label == 'Tuesday' ) { $label = 'Dienstag'; } else if ( $label == 'Wednesday' ) { $label = 'Mittwoch'; } else if ( $label == 'Thursday' ) { $label = 'Donnerstag'; } else if ( $label == 'Friday' ) { $label = 'Freitag'; } else if ( $label == 'Saturday' ) { $label = 'Samstag'; } if ( $conditions == 'Clear' ) { $conditions = 'Klar'; } else if ( $conditions == 'Chance of Snow' ) { $conditions = 'Möglicherweise Schnee'; } else if ( $conditions == 'Chance of Rain' ) { $conditions = 'Möglicherweise Regen'; } else if ( $conditions == 'Chance of Freezing Rain' ) { $conditions = 'Möglicherweise Hagel'; } else if ( $conditions == 'Chance of Sleet' ) { $conditions = 'Möglicherweise Schnee'; } else if ( $conditions == 'Chance of a Thunderstorm' ) { $conditions = 'Möglicherweise einzelne Gewitter'; } else if ( $conditions == 'Chance of Thunderstorms' ) { $conditions = 'Möglicherweise Gewitter'; } else if ( $conditions == 'Cloudy' ) { $conditions = 'Wolkig'; } else if ( $conditions == 'Flurries' ) { $conditions = 'Böen'; } else if ( $conditions == 'Fog' ) { $conditions = 'Nebel'; } else if ( $conditions == 'Freezing Rain' ) { $conditions = 'Hagel'; } else if ( $conditions == 'Haze' ) { $conditions = 'Dunst'; } else if ( $conditions == 'Mostly Cloudy' ) { $conditions = 'Größtenteils wolkig'; } else if ( $conditions == 'Mostly Sunny' ) { $conditions = 'Größtenteils sonnig'; } else if ( $conditions == 'Overcast' ) { $conditions = 'Wolkenverhangen'; } else if ( $conditions == 'Partly Cloudy' ) { $conditions = 'Teilweise wolkig'; } else if ( $conditions == 'Partly Sunny' ) { $conditions = 'Teilweise sonnig'; } else if ( $conditions == 'Rain' ) { $conditions = 'Regen'; } else if ( $conditions == 'Scattered Clouds' ) { $conditions = 'Vereinzelt wolkig'; } else if ( $conditions == 'Sleet' ) { $conditions = 'Schneeregen'; } else if ( $conditions == 'Snow' ) { $conditions = 'Schnee'; } else if ( $conditions == 'Sunny' ) { $conditions = 'Sonnig'; } else if ( $conditions == 'Thunderstorms' ) { $conditions = 'Gewitter'; } else if ( $conditions == 'Thunderstorm' ) { $conditions = 'einzelne Gewitter'; } else if ( $conditions == 'Unknown' ) { $conditions = 'unbekannt'; } }
Hi everybody,
I’ve released version 2.0 of the plugin that adds full translation support. I’m sorry it took so long! The plugin now pulls in Wunderground-translated forecasts.Please see the International information section to find out more.
I’d love your help translating the plugin! Here’s the translation page. Please add your language and I’ll include it in the core plugin.
Thanks,
Zack
- The topic ‘Language’ is closed to new replies.