Metastem / wikiless

A free open source alternative Wikipedia front-end focused on privacy.
https://wikiless.chaosmos.io/
GNU Affero General Public License v3.0
163 stars 18 forks source link

Support both Chinese versions (Simplified and Traditional) #83

Open honobo opened 1 year ago

honobo commented 1 year ago

zh.wikipedia.org provides multiple versions using different writing systems, among others: 1) Chinese written in simplified letters, commonly used in mainland China 2) Chinese written in traditional letters, commonly used in Taiwan

Conceptually the two are like en-US vs. en-GB but the difference is more radical, as every "alphabet" (letter, "glyph") used to write words are different-shaped, only vaguely similar.

On WP the user may select their familiar flavor of Chinese via 不转换 menu. For example, if you open... https://zh.wikipedia.org/wiki/%E9%97%A8%E7%BD%97%E5%B8%81 ...and then select 臺灣正體, then you'll get https://zh.wikipedia.org/zh-tw/%E9%97%A8%E7%BD%97%E5%B8%81 which is written in Chinese with the traditional writing system, using the Taiwanese orthography.

Though WP has more Chinese options than the above two, practically it is roughly sufficient if zh-CN & zh-TW are supported (or technically: zh-Hans & zh-Hant). If necessary, educated Chinese speakers can read both, but the two are so different that e.g. for a Taiwanese person, reading a long zh-CN text can be painful, and vice versa.

So It would seem ideal if Wikiless too somehow supports the selection between lang=zh-tw and lang=zh-cn, especially considering that many of the users who might be greatly helped by Wikiless are (or will be) Chinese people behind the Great Firewall (i.e. those who may not be able to read the regular Wikipedia articles freely).

xbdmHQ commented 1 year ago

If you can make a pull request instead to speed this up, this will help great fully. I have some real life issues and work so I can't really work on it right now!

xbdmHQ commented 1 year ago

@honobo

honobo commented 1 year ago

I just quick-checked the source code, and as it turned out, these are already supported: const lang_variants = ['zh-hans','zh-hant','zh-cn','zh-hk','zh-mo','zh-my','zh-sg','zh-tw']

So one can already do this: 1) Open a Chinese (中文) page normally e.g. https://wl.vern.cc/wiki/%E6%B1%89%E8%AF%AD?lang=zh 2) Add a subtag (e.g. -tw) and open that URL https://wl.vern.cc/wiki/%E6%B1%89%E8%AF%AD?lang=zh-tw

While there doesn't appear to be an obvious GUI for this, typing -tw etc. is easy enough in practice. You can perhaps close this issue since basically it's been already implemented.

If anything, maybe accept uppercase letters just in case; language tags are case-insensitive and people tend to type e.g. zh-TW or zh-Hant. Something trivial like... if(req.query && req.query.lang) { - return req.query.lang + return req.query.lang.toLowerCase() }

Thanks again for your tolerance and assistance toward diverse cultures and complicated situations in Asia :)