I've tried it both ways, and have come to prefer the "flatted" approach for
a few reasons.
If a translator forgets to translate "title", you end up with the literal
text "title", which is not very useful. The English equivalent serves as a
better backstop.
Better reuse of translated strings. I was able to eliminate a number of
duplicates by flattening things.
While $page means something to you and me, it does not to a translator. I
had to continually remind myself whether it is a symbol for the HTML page
name, the .inc name, or the name of the subsection in the .conf file.
Finally, having added a bunch of translations to a bunch of different
skins, it's hard, tedious work! We desperately need some tools to help. in
particular, an equivalent to the GNU utility xgettext. I think this will be
a lot easier to write with a flattened name space. In fact, despite having
pushed you in that general direction, I'm thinking of doing away with the
"subscripting" notation and going back to your original "functional"
notation of $gettext('translate me', 'some context'). It would be easier to
write a tool for it.
This is why the beta period has been so long. The stakes are high, and I
want to experiment and make sure we get it right!
-tk
All-in-all, I didn't see the problem it was trying to solve.
On Thu, Sep 9, 2021 at 7:16 AM Karen K <[email protected]> wrote:
> Tom Keffer schrieb am Freitag, 13. August 2021 um 19:07:54 UTC+2:
>
>> Notable change since the alpha versions is that the "lang" files have
>> been "flattened." This makes them easier to maintain.
>>
>
> I would like to comment this.
>
> For the skins that come with WeeWX like Seasons skin I would agree with
> you that the flattened language files are easier to maintain.
>
> For big skins that are available as an extension there is a reason that
> speaks against flattened files. That is: If the skin has a lot of pages and
> thus a log of templates, the author may use a central .inc file to define
> the HTML and page headers including page dependent meta tags and the page
> title H1 tag. And in this case $gettext[$page]['title'] and something comes
> in useful as you can put it into the .inc file and it picks the appropriate
> text for the given template automatically.
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-development/6adf05be-c438-4f76-adc2-9e2751aca6cbn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/6adf05be-c438-4f76-adc2-9e2751aca6cbn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-development/CAPq0zEAMM8oKExDxMM%3DzBxPMVEuf5Ls8DK8uzVNsiK1z8OOuhw%40mail.gmail.com.