Skip to content

Translation and Localization of the Belchertown Skin

biltmorelaker edited this page Apr 15, 2019 · 4 revisions

Localization - Modifying the Belchertown Skin for other Languages, Date/Time representations and Measurement systems

Philosophy

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.

More detail on how to localize the Belchertown skin follows:

Translating the Skin

The skin uses variable labels set to default values for virtually every text item and title on the generated web pages. This allows you to translate, or change, the words within the skin easily. You can either edit the variables listed in the [Labels] [[Generic]] section within skin.conf or, (the preferred method) copy these to weewx.conf's [[[Labels]]] [[[[Generic]]]] stanza and edit them there. If you edit them within skin.conf, your changes will be lost on upgrades.

Date and Time Formatting for Your Locale

Starting with version 0.9 of the skin virtually all date and time formats are managed by Javascript using the moment.js library. You can read the thoughts, comments and commits of the skin's author here. Moment.js formats the date and time a lot more elegantly than Python. There are so many areas in this skin that use date and time that the author has chosen to let moment.js format these automatically based on the locale and timezone setting on the server running WeeWX. The downside is in order to change the way moment.js formats an item, you'll need to manually edit skins/Belchertown/js/belchertown.js.tmpl to make those updates.

If you notice date, time or timezone formatting that looks wrong, check to see what the system locale is set for on the computer running WeeWX. On most Linux systems you simply issue the locale command to do this. On Windows 10 machines, you can check the system locale in the Control Panel. If necessary, please set the proper locale and timezone on your WeeWX server, and restart your server.

Measurement System Units

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.

Getting Help

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 poblabs/weewx-belchertown GitHub repository (https://github.com/poblabs/weewx-belchertown/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.