It is currently May 2nd, 2024, 11:37 pm

Weather not working?

Get help with creating, editing & fixing problems with skins
dasxardas
Posts: 25
Joined: March 6th, 2020, 9:38 am

Re: Weather not working?

Post by dasxardas »

I'm not able to make it works. :( I found only one way replace
Substitute="New":"#@#MoonPhaseIcons\0.png","Waxing Crescent":"#@#MoonPhaseIcons\1.png",
with:
Substitute="New(in wanted lang, Neu, Nový,...)":"#@#MoonPhaseIcons\0.png","Waxing Crescent(in wanted lang)":"#@#MoonPhaseIcons\1.png", etc...

In main ini file, but this is not user friendly or write the same parameter in every language with ";" Maybe anybody find better way. All other measures are working. Also I made to work RWF6 and RWF5 with icons from 6, but those moon phases are too hard for me.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16195
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather not working?

Post by balala »

dasxardas wrote: March 8th, 2020, 9:06 pm If i change code below to language which is set in Variables for example cz-CZ so moon phases are working again.
I have to admit I didn't follow too closely this discussion, but the language code of the Czech language is not cz-CZ, but cs-CZ. First thing which indicated that cz-CZ is wrong was the fact that with this variable, beside getting all strings in English, I also got the temperatures in the imperial scale, which for sure is not used in the Czech Republic. Then I checked the list of language codes and found the error, described above.
dasxardas
Posts: 25
Joined: March 6th, 2020, 9:38 am

Re: Weather not working?

Post by dasxardas »

balala wrote: March 9th, 2020, 4:53 pm I have to admit I didn't follow too closely this discussion, but the language code of the Czech language is not cz-CZ, but cs-CZ. First thing which indicated that cz-CZ is wrong was the fact that with this variable, beside getting all strings in English, I also got the temperatures in the imperial scale, which for sure is not used in the Czech Republic. Then I checked the list of language codes and found the error, described above.
Sorry I have cs-CZ i made a mistake here. But on picture are how it looks in many lang I tested on picture are czech, german, english and french. Used codes: cs-CZ, en-GB, de-DE, fr-FR
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16195
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather not working?

Post by balala »

dasxardas wrote: March 9th, 2020, 5:42 pm But on picture are how it looks in many lang I tested
And is there any problem with any of those languages?
dasxardas
Posts: 25
Joined: March 6th, 2020, 9:38 am

Re: Weather not working?

Post by dasxardas »

balala wrote: March 9th, 2020, 5:52 pm And is there any problem with any of those languages?
No. As you can see in english moon phases picture is shown, but if you switch to any other language it doesn't matter which, moon phases picture is not shown, but translations are ok. I think that problem is, that it isn't coded same as forecasts but here are syntax below:

Code: Select all

[MeasureMoonPhaseIcon]
Measure=String
String=[@MoonDay1PhaseName]
DynamicVariables=1
Substitute="New":"#@#MoonPhaseIcons\0.png","Waxing Crescent":"#@#MoonPhaseIcons\1.png","First Quarter":"#@#MoonPhaseIcons\2.png","Waxing Gibbous":"#@#MoonPhaseIcons\3.png","Full":"#@#MoonPhaseIcons\4.png","Waning Gibbous":"#@#MoonPhaseIcons\5.png","Last Quarter":"#@#MoonPhaseIcons\6.png","Waning Crescent":"#@#MoonPhaseIcons\7.png"
So if server returns translated moon phase, skin don't know, which picture should use. If I write Substitute="Nový":"#@#MoonPhaseIcons\0.png" instead of Substitute="New":"#@#MoonPhaseIcons\0.png" and switch to cs-CZ picture is shown. But this isn't solution make this long syntax for each language, it should works as forecasts but I don't know how to change it to works. I tried changes in WeatherComJSONMoon.inc but if I don't know hot it works, it is too hard for me.
Last edited by balala on March 9th, 2020, 6:11 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are you posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16195
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather not working?

Post by balala »

dasxardas wrote: March 9th, 2020, 6:05 pm No. As you can see in english moon phases picture is shown, but if you switch to any other language it doesn't matter which, moon phases picture is not shown, but translations are ok.
Now I see what are you talking about. Yep, you're right.
Should get the appropriate file path and name on the [MeasureMoonPhaseIcon] measure, no matter of the set language. Working with this I finally figured out two different, a little bit complicated solutions, but at least they are working:
  • We should extend the substitution made on the previously mentioned [MeasureMoonPhaseIcon] measure. Add a RegExpSubstitute=1 option to the measure and modify its Substitute option to the following one: Substitute="(?i)full moon in your language":"Full","(?i)first quarter in your language":"First Quarter","(?i)last quarter in your language":"Last Quarter","(?i)new moon in your language":"New","(?i)waxing crescent in your language":"Waxing Crescent","(?i)waxing gibbous in your language":"Waxing Gibbous","(?i)waning gibbous in your language":"Waning Gibbous","(?i)waning crescent in your language":"Waning Crescent","New":"#@#MoonPhaseIcons\0.png","Waxing Crescent":"#@#MoonPhaseIcons\1.png","First Quarter":"#@#MoonPhaseIcons\2.png","Waxing Gibbous":"#@#MoonPhaseIcons\3.png","Full":"#@#MoonPhaseIcons\4.png","Waning Gibbous":"#@#MoonPhaseIcons\5.png","Last Quarter":"#@#MoonPhaseIcons\6.png","Waning Crescent":"#@#MoonPhaseIcons\7.png".
    Note the substitutions added before the previous first substitution (marked red above). Obviously you have to replace the full moon in your language, first quarter in your language (and so on) string with the appropriate translations in your language.
  • This second solution seem much more elegant. Starting from the original, unmodified code, add the following measures:

    Code: Select all

    [EntireSiteSuperParent]
    Measure=WebParser
    URL=https://weather.com/en-GB/weather/today/l/#LocationCode#
    DecodeCharacterReference=1
    UpdateRate=#UpdateRate#
    LogSubstringErrors=0
    RegExp=(?siU)^(.*)$
    StringIndex=1
    
    [MoonParent]
    Measure=WebParser
    Group=Parents
    URL=[EntireSiteSuperParent]
    StringIndex=1
    RegExp=(?siU)"vt1dailyForecast":\[{"validDate":"(.*)",.*"moonIcon":"(.*)","moonPhrase":"(.*)","moonrise":"(.*)","moonset":"(.*)",.*{"validDate":"(.*)",.*"moonIcon":"(.*)","moonPhrase":"(.*)","moonrise":"(.*)","moonset":"(.*)",.*{"validDate":"(.*)",.*"moonIcon":"(.*)","moonPhrase":"(.*)","moonrise":"(.*)","moonset":"(.*)",.*{"validDate":"(.*)",.*"moonIcon":"(.*)","moonPhrase":"(.*)","moonrise":"(.*)","moonset":"(.*)",.*{"validDate":"(.*)",.*"moonIcon":"(.*)","moonPhrase":"(.*)","moonrise":"(.*)","moonset":"(.*)",.*{"validDate":"(.*)",.*"moonIcon":"(.*)","moonPhrase":"(.*)","moonrise":"(.*)","moonset":"(.*)",
    
    [MoonDay1PhaseName]
    Measure=WebParser
    URL=[MoonParent]
    StringIndex=3
    Modify the String option of the [MeasureMoonPhaseIcon] measure to the following one: String=[MoonDay1PhaseName] (instead of the original String=[@MoonDay1PhaseName]).
Now you should get the appropriate Moon icon on the skin, with any of the above two procedures. Is it there?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather not working?

Post by eclectic-tech »

dasxardas wrote: March 9th, 2020, 6:05 pm No. As you can see in english moon phases picture is shown, but if you switch to any other language it doesn't matter which, moon phases picture is not shown, but translations are ok. I think that problem is, that it isn't coded same as forecasts but here are syntax below:

Code: Select all

[MeasureMoonPhaseIcon]
Measure=String
String=[@MoonDay1PhaseName]
DynamicVariables=1
Substitute="New":"#@#MoonPhaseIcons\0.png","Waxing Crescent":"#@#MoonPhaseIcons\1.png","First Quarter":"#@#MoonPhaseIcons\2.png","Waxing Gibbous":"#@#MoonPhaseIcons\3.png","Full":"#@#MoonPhaseIcons\4.png","Waning Gibbous":"#@#MoonPhaseIcons\5.png","Last Quarter":"#@#MoonPhaseIcons\6.png","Waning Crescent":"#@#MoonPhaseIcons\7.png"
Balala offered a working alternative, but here is one that does not require new measures...

Replace the above measure with this to display the moon phases... my first mod did not consider other languages, this uses the moon phase data from TWC.

Code: Select all

[MeasureMoonPhaseIcon]
Measure=String
String=[@MoonDay1PhaseIcon]
DynamicVariables=1
Substitute="N":"#@#MoonPhaseIcons\0.png","WXC":"#@#MoonPhaseIcons\1.png","FQ":"#@#MoonPhaseIcons\2.png","WXG":"#@#MoonPhaseIcons\3.png","F":"#@#MoonPhaseIcons\4.png","WNG":"#@#MoonPhaseIcons\5.png","LQ":"#@#MoonPhaseIcons\6.png","WNC":"#@#MoonPhaseIcons\7.png"
moonczech.png
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16195
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather not working?

Post by balala »

eclectic-tech wrote: March 9th, 2020, 8:36 pm Balala offered a working alternative, but here is one that does not require new measures...

Replace the above measure with this to display the moon phases... my first mod did not consider other languages, this uses the moon phase data from TWC.
Indeed much more elegant and simple. Beside this, mine is sucks.
Congrats...
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather not working?

Post by eclectic-tech »

balala wrote: March 9th, 2020, 8:42 pm Indeed much more elegant and simple. Beside this, mine is sucks.
Congrats...
Yours simply overlooked that the skin already had parsed the info, while I just didn't take the time to test it before... :)

No good deed goes unpunished! :x

I updated my previous post with a corrected version. Here...
User avatar
Yincognito
Rainmeter Sage
Posts: 7190
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather not working?

Post by Yincognito »

balala wrote: March 9th, 2020, 8:42 pm Indeed much more elegant and simple. Beside this, mine is sucks.
Congrats...
I'm not sure if this is more "elegant" ... but yes, it's a bit smarter, as it takes advantage of the "duplicate" moon phase string (aka its abbreviation) in the TWC data. Such tricks can similarly be applied to Phrase and Narrative, if needed in a specific scenario, for example.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth