Jump to content


Photo

Translate weather information on skin


  • Please log in to reply
4 replies to this topic

#1 zeldoox

  • Member
  • 6 posts

0
Neutral

Posted 7 August 2016 - 12:35

Hello.

I have added to my skin various widgets to see meteo information using yweather converter. At this point

 

<widget source="session.CurrentService" render="Label" position="505,131" size="361,28" font="Regular; 22" halign="center" foregroundColor="red" backgroundColor="black" transparent="1" zPosition="2">
  <convert type="YWeather">text</convert>
</widget>

 

i see a description of the weather condition in english.

Is there a way to translate in italian, using for example po file of yahoo weather plugin?

Thanks,



Re: Translate weather information on skin #2 zeldoox

  • Member
  • 6 posts

0
Neutral

Posted 8 August 2016 - 11:25

I don't know python.

In yweather.py converter i see

 

        elif self.type == self.wtext:
            info = xweather['ytext']

 

I can add to py file something as

 

        if wtext == 'Sunny':
            return _('Soleggiato')
                    else:
            return wtext

 

But it don't work.



Re: Translate weather information on skin #3 Loui (PD1LOI)

  • Senior Member
  • 4,621 posts

+146
Excellent

Posted 8 August 2016 - 11:33

I don't know python.

In yweather.py converter i see

 

        elif self.type == self.wtext:
            info = xweather['ytext']

 

I can add to py file something as

 

        if wtext == 'Sunny':
            return _('Soleggiato')
                    else:
            return wtext

 

But it don't work.

Can you put the plugin here?



Re: Translate weather information on skin #4 zeldoox

  • Member
  • 6 posts

0
Neutral

Posted 8 August 2016 - 12:03

Here it is.

It creates a yweather.xml file in tmp.

 

Here there are part of the iformation that it extracts.

 

<pubDate>Mon, 08 Aug 2016 12:00 PM CEST</pubDate>
<yweather:condition xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="32" date="Mon, 08 Aug 2016 12:00 PM CEST" temp="25" text="Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="34" date="08 Aug 2016" day="Mon" high="26" low="15" text="Mostly Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="47" date="09 Aug 2016" day="Tue" high="26" low="17" text="Scattered Thunderstorms"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="47" date="10 Aug 2016" day="Wed" high="22" low="16" text="Scattered Thunderstorms"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="30" date="11 Aug 2016" day="Thu" high="21" low="14" text="Partly Cloudy"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="34" date="12 Aug 2016" day="Fri" high="22" low="14" text="Mostly Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="32" date="13 Aug 2016" day="Sat" high="24" low="15" text="Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="34" date="14 Aug 2016" day="Sun" high="25" low="16" text="Mostly Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="34" date="15 Aug 2016" day="Mon" high="26" low="17" text="Mostly Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="34" date="16 Aug 2016" day="Tue" high="26" low="18" text="Mostly Sunny"/>
<yweather:forecast xmlns:yweather="http://xml.weather.y....com/ns/rss/1.0" code="30" date="17 Aug 2016" day="Wed" high="25" low="17" text="Partly Cloudy"/>

Attached Files


Edited by zeldoox, 8 August 2016 - 12:07.


Re: Translate weather information on skin #5 zeldoox

  • Member
  • 6 posts

0
Neutral

Posted 9 August 2016 - 06:55

By trials and errors, modifing the py file it finally works

 

        elif self.type == self.wtext:
            if xweather['ytext']  ==  'AM Clouds/PM Sun':
                info = "AM Nuvole/PM Sole"




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users