Translation and Localization - uajqq/weewx-belchertown-new GitHub Wiki
Localization - Modifying the Belchertown Skin for other Languages, Date/Time representations and Measurement systems
To make the Belchertown skin "localization friendly" virtually all of the text values displayed on the skin's web pages have been defined as variables in the skin.conf file. As a result, the variable values can be changed to the appropriate language in skin.conf or, to prevent them from being reset when the skin is updated, they can be added to the weewx.conf file.
Proper formatting of dates and times displayed by the Belchertown skin relies upon the appropriate setting of the system locale on the computer running WeeWX.
Measurement system units used to display observation data (e.g. oC vs. oF) are changed by adding entries to weewx.conf in the same way it is done for most WeeWX skins.
The skin uses the "default labels" for every text and title on the page. This allows you to translate, or simply just change the words to something else easily. You can either edit the [Labels]
[[Generic]]
section within skin.conf, or (preferred) copy these labels to your [Belchertown]
skin settings within weewx.conf's. If you edit them within skin.conf, your changes will be lost on upgrades. Here is a sample weewx.conf config:
[[Belchertown]]
skin = Belchertown
HTML_ROOT = belchertown
[[[Extras]]]
forecast_enabled = 1
... other Extras options here ...
[[[Labels]]]
[[[[Generic]]]]
home_page_header = "Belchertown Weather Conditions"
twitter_owner = PatOBrienPhoto
twitter_hashtags = "PWS #weewx #weather #wx"
rain = My Custom Rain Label
graphs_page_day_button = Today
You can modify the moment.js string formats using the skin.conf Labels section and look for the moment.js section beneath. For a list of all string formats that moment.js can use, check https://momentjs.com/docs/#/parsing/string-format/
If you notice that there are date, time and timezone formatting that looks wrong for your locale, you can set the proper locale and timezone on your WeeWx server, and restart your server, or don't use moment.js locale aware string formats and use a manual definition instead. For example if you want Wednesday 15 May 20:25
you would use this formatting: dddd DD MMM HH:mm
.
Explanation (this comes right from the moment.js documentation):
-
dddd
gives you full day name, like Saturday.ddd
would give you short day name like Sat -
DD
would give you the day's date as a number with a leading 0, like 05. If you want just 5 it would beD
-
MMM
gives you the short name of the month like "Jan". If you want "January" it'd beMMMM
-
HH
is the hour in 24 hour format with a leading 0, like 02. If you don't want the leading 0 it would beH
. -
mm
is the minute with a leading 0, like 08. If you don't want the leading 0, usem
.
Measurement system units for observation values displayed by the Belchertown skin (e.g. oC vs. oF) are controlled by entries in the [StdReport]
stanza of weewx.conf. A description of how to change those units to reflect the WeeWx user's desired display is well documented in the WeeWX Customization Guide.
Please note: setting the units used in the WeeWX database does NOT impact units used to show observation values. As described here in the WeeWX Users Guide, changes to the [StdConvert]
WeeWX service has nothing to do with what units are displayed in plots or files.
The best place to find help if you encounter problems is the Google weewx-users group (https://groups.google.com/forum/#!forum/weewx-user). This is the official WeeWX place to post questions and request help. The developer of the Belchertown skin is active there as are other WeeWX developers and many knowledgeable users. All are helpful to those who encounter issues with WeeWX implementations.
If your issue is caused by a bug you find in the Belchertown skin, or you have a feature request, you can open an Issue on the uajqq/weewx-belchertown-new GitHub repository (https://github.com/uajqq/weewx-belchertown-new/issues). If you are testing release candidates of the Belchertown skin, this is probably the best place to note any problems or bugs you encounter.