Two questions, one about copy/past editor and difference between $obs.label and $gettext

43 views
Skip to first unread message

DR

unread,
Feb 10, 2026, 8:13:21 PM (8 days ago) Feb 10
to 'Jon Fear' via weewx-user
I'm playing with the current.inc display for a page and with some help 
years ago from one of the leaders here, got the 6th line shown below to
display the change in temp from 24 hours ago. Running  under 4.7.0, I
was able to place a little 'delta' sign in front of the (
$trend(time_delta....... which I thought looked sort of nice.  I recall
trying to enter it with the Alt-xxx key but apparently the RaspOS didn't
like that and Tom, I believe, told me to just find a symbol somewhere
and paste it in position. That did the trick.  Now I have my 5.2 running
and moved this line over to the new current.inc code and the delta
disappeared.   I tried several copy and pastes, all from on-line
collections of symbols and it just leaves a blank.

Is there some way to recover my little delta sign?  Are some editors in
RaspOS better than others?


Secondly, the new way of building  an observation list and then stepping
through it means that if I want to add the Rainfall Yesterday and the
time and interval of the last rain the the final portion of the code
below, I have to tack it on to the #elif $x == 'rain' segment. That is
perfect and make sense to me.  My question is, why do some of the HTML
class-"label"> statements use $gettext("Rain Today") while other
segments use <td class="label">$obs.label.wind  for example.  They seem
to do the same thing.  Is one more preferable than the other?  The
$obs.label seems to work just fine and the $gettext is in the newer code
but I don't see it in the 4.7 (ancient, I know but it works!)

Maybe there is no simple explanation but wondered if one is better than
the other?

Dale



#for $x in $observations
  #if $getVar('year.%s.has_data' % $x)
    #if $x == 'outTemp'
       <tr>
        <td class="label">$obs.label.outTemp</td>
        <td class="data">$current.outTemp (
$trend(time_delta=86400).outTemp.format("%+.1f"))</td>
      </tr>
    #elif $x == 'barometer'
      <tr>
        <td class="label">$obs.label.barometer</td>
        <td class="data">$current.barometer
($trend.barometer.format("%+.3f"))</td>
      </tr>
    #elif $x == 'windSpeed'
      <tr>
        <td class="label">$obs.label.wind</td>
        <td class="data">$current.windSpeed
$current.windDir.ordinal_compass ($current.windDir)</td>
      </tr>
    #elif $x == 'rain'
      <tr>
        <td class="label">$gettext("Rain Today")</td>
        <td class="data">$day.rain.sum</td>
      </tr><tr>
    <td class="label">$obs.label.Rainfall Yesterday</td>
        <td class="data">$day($days_ago=1).rain.sum</td>
      </tr>
      <tr>
       <td class="label">$obs.label.Last Rain</td>
       <td class="data">$time_at('rain>0')<br/>$time_since('rain>0')
ago</td>
       </tr>
    #else


Vince Skahan

unread,
Feb 10, 2026, 9:30:23 PM (8 days ago) Feb 10
to weewx-user
I'm sure there's an easier way, but one way to get unicode characters is at https://www.posterpresentations.com/alt-code-cheatsheet.html - copy the item using a browser, paste into your cheetah template.  When the reports run, it'll work.

For the other questions, I'd suggest the $obs.label.whatever uses the defined Label for that item.  A quick google search for "cheetah $gettext" seems to say that $gettext("some string here") just puts a string in there with python doing any internationalization that might be needed per https://docs.python.org/3/library/gettext.html


DR

unread,
Feb 10, 2026, 10:30:18 PM (8 days ago) Feb 10
to weewx...@googlegroups.com
Thank  you again for  your pointers.


The delta sign is only a tweak.

The other info helps clarify for me, who never knows what  is coming as
a command for the image generators and such, what they mean.

You are most helpful and have given me a couple new places to go to
learn a bit more.  Dale



Karen K

unread,
Feb 11, 2026, 4:19:35 AM (8 days ago) Feb 11
to weewx-user
In this case $gettext is not some general Python thing but a WeeWX feature to localize  arbitrary text. Observation types are localized using $obs.label.observation_type_name. If the text to localize is not an observation type like "Rain Today", then $gettext steps in. There are language files that reside in the lang subdirectory of the skin directory. There you find the localized names for the observation types in section [Labels][[Generic]] and the localized versions of other text in section [Texts].

DR

unread,
Feb 11, 2026, 8:48:25 AM (7 days ago) Feb 11
to weewx...@googlegroups.com
Thank   you for the leads to study on how this works.

I would never have figured that out without this forum's participant's
help!  Dale


Reply all
Reply to author
Forward
0 new messages