Localization,cn--->zh_cn

160 views
Skip to first unread message

Kranz Liang

unread,
Jan 5, 2024, 11:20:41 PM1/5/24
to weewx-user
I have translated the language files in weewx, converting Traditional Chinese into Simplified Chinese and also adjusted some word usages to better conform with the linguistic habits of users in Simplified Chinese regions. However, after these modifications, I am encountering garbled characters on the display interface and am unable to resolve this issue.
屏幕截图 2024-01-06 112047.png屏幕截图 2024-01-06 112005.png
zh_cn.conf

Graham Eddy

unread,
Jan 5, 2024, 11:58:57 PM1/5/24
to WeeWX User
maybe check the font_path in skins.conf, ensure the image generator fonts include the simplified chinese symbols
⊣GE⊢

michael.k...@gmx.at

unread,
Jan 6, 2024, 4:59:34 AM1/6/24
to weewx-user
This reveals also a limitation of  WeeWX  current localization support: according to Wikipedia's interpretation of ISO-639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) "Chinese" is "zh" and there is no way to distinguish between Traditional and Simplified Chinese. WeeWX documentation (https://weewx.com/docs/5.0/custom/localization/#create-the-localization-file) doesn't exactly refer to ISO-639-1 but only to "ISO language and country codes" linking to w3schools (https://www.w3schools.com/tags/ref_language_codes.asp), where w3schools seems to have i's own interpretation of ISO-639-1  (they are listing currently 191 language codes where wikipedia lists 184). 

WeeWX seems to curve around this by inventing a language abbreviation unknown to ISO-639-1: "cn" https://github.com/weewx/weewx/blob/master/skins/Seasons/lang/cn.conf

Bottom line: currently I don't know a solution to solve traditional vs. simplified chinese translation without non-standard workarounds.

Back to the very initial topic: @Kranz Liang can you check if you find a font that works for you there: https://fonts.google.com/noto/specimen/Noto+Sans+SC 

Kranz Liang

unread,
Jan 6, 2024, 5:29:04 AM1/6/24
to weewx-user
Thanks!
The idea of editing the font configuration file in skin.conf was indeed correct. It just turned out that the font I initially chose was not supported. After switching to NotoSansSC, the seasons skin successfully ran
.屏幕截图 2024-01-06 182759.png

michael.k...@gmx.at

unread,
Jan 6, 2024, 6:02:41 AM1/6/24
to weewx-user
Rather than changing skin.conf you are probably better off adding the config in the matching section of weewx.conf, or your changes will be overwritten on next update. See https://weewx.com/docs/4.10/customizing.htm#customizing_reports

michael.k...@gmx.at

unread,
Jan 6, 2024, 7:57:05 AM1/6/24
to weewx-user
Another thing is that NotoSansSC is a bit large when it comes to e.g. shipping it bundled with a skin. 10MB for a single kind of font weight.

Tom Keffer

unread,
Jan 6, 2024, 8:22:18 AM1/6/24
to weewx...@googlegroups.com
Thanks for pointing that out. I'm not sure where "cn" came from. We'll change it to 'zh".

Issue #912.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/392913a4-85e3-4090-b049-afba80a4c51dn%40googlegroups.com.

michael.k...@gmx.at

unread,
Jan 6, 2024, 11:29:11 AM1/6/24
to weewx-user
Where ever it came from, it propagated :D

It still leaves me unsure how to handle the font thing, the thai fonts is shipped with the skin, but has a way smaller footprint.

Nate Bargmann

unread,
Jan 6, 2024, 11:50:30 AM1/6/24
to weewx...@googlegroups.com
* On 2024 06 Jan 07:22 -0600, Tom Keffer wrote:
> Thanks for pointing that out. I'm not sure where "cn" came from. We'll
> change it to 'zh".

Perhaps the confusion stems from .cn being a top level domain:

https://en.wikipedia.org/wiki/.cn

There are so many of these things that it is easy to get things mixed
up. i18n is still something we in the western world are slowly working
toward getting right.

- Nate

--
"The optimist proclaims that we live in the best of all
possible worlds. The pessimist fears this is true."
Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819

signature.asc

Chuck Rhode

unread,
Jan 6, 2024, 1:33:34 PM1/6/24
to 'michael.k...@gmx.at' via weewx-user
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 6 Jan 2024 04:57:04 -0800 (PST)
"'michael.k...@gmx.at' via weewx-user" <weewx...@googlegroups.com>
wrote:

> Another thing is that NotoSansSC is a bit large when it comes to
> e.g. shipping it bundled with a skin.

Not my field (Web design), but I'm under the impression you can load
an (optimized) font over the wire by placing a "link" metatag in your
HTML HEADers.

+ https://www.w3schools.com/csS/css_font_google.asp

I believe your content-delivery network (CDN — everybody has one) will
cache the common fonts. In your reader's browser, supposing modern
high-speed Internet connection and sufficient bandwidth, it matters
little whether it loads a font from the local harddrive or over the
wire. Everyone can and does load fonts over the wire, so this is a
way to economize the size of software packages.

- --
.. Be Seeing You,
.. Chuck Rhode, Sheboygan, WI, USA
.. Weather: http://LacusVeris.com/WX
.. 31° — Wind ESE 5 mph — Sky overcast. Light snow; mist.

-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQT+MY/5I/LMPSswTbVg2/xipKOWUgUCZZmc7QAKCRBg2/xipKOW
UhTKAJ0UsDhjEjlNBiICEjkUAr6hITxIeQCfVaF5EGH/CPEHBD0jDMMoLZJb168=
=6Xer
-----END PGP SIGNATURE-----

michael.k...@gmx.at

unread,
Jan 6, 2024, 2:54:54 PM1/6/24
to weewx-user
That's correct and a possibility. Nevertheless, there are many reasons not to go the CDN way. GDPR is just one of them.

kranz

unread,
Jan 7, 2024, 1:04:28 AM1/7/24
to weewx...@googlegroups.com
In Chinese, font files tend to be relatively large because unlike the English alphabet with its 26 letters that can compose all possible words, Chinese characters do not operate on an alphabetic principle. Each unique character in a Chinese font file represents a distinct graphical symbol, and there are thousands of commonly used characters alone—more than 3,000 as you mentioned. This means that each font must include representations for these numerous characters, which contributes to the overall size of the font file compared to a typical Latin font. Additionally, since Chinese characters are more complex graphically, they often require more space and data to store and render.

'michael.k...@gmx.at' via weewx-user <weewx...@googlegroups.com> 于2024年1月7日周日 00:29写道:
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qcogpWfSThk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/bcb0807d-94ae-49c5-9e90-559614c582b6n%40googlegroups.com.


--
春暖话开!
Reply all
Reply to author
Forward
0 new messages