Skip to content

Automatic conversion between Traditional and Simplified Chinese #4669

Open
@anthonyfok

Description

@anthonyfok

For a multilingual website supporting the Chinese language, it is best to cater to both Simplified Chinese "zh-Hans" (zh-CN, zh-SG) and Traditional Chinese "zh-Hant" (zh-TW, zh-HK) audiences. It would be great if Hugo could automatically generate both zh-Hans and zh-Hant pages from a single .zh.md file, with the possibility of manual override if necessary. Some noteworthy examples are:

  1. The feature could be enabled globally, and enabled/disabled in the front matter of individual pages.
  2. When enabled, filename.zh.md would generate the corresponding filename.zh.html, filename.zh-Hans.html, filename.zh-Hant.html, as well as filename.zh-CN.html, filename.zh-TW.html and filename.zh-HK.html if the user desires (configurable), unless, for example, filename.zh-Hant.md already exists.
  3. Provide automatic conversion with Go port of OpenCC or similar.
  4. Allow manual override to prevent certain text from being converted.
  5. Allow custom conversion list for certain phrase-level/variant conversion.

Automatic conversion

OpenCC, written by @BYVoid and hosted at https://github.com/BYVoid/OpenCC, is currently one of the most popular and likely the best open-source Chinese conversion tool:

Open Chinese Convert (OpenCC, 開放中文轉換) is an opensource project for conversion between Traditional Chinese and Simplified Chinese, supporting character-level conversion, phrase-level conversion, variant conversion and regional idioms among Mainland China, Taiwan and Hong kong.

And a good news! @liuzl, a Hugo user himself, recently ported OpenCC to a pure Go implementation called GoCC, see https://github.com/liuzl/gocc

Manual override / Custom conversion list

Yes, Chinese Wikipedia has these features. I am not sure which syntax we should use for Hugo, or perhaps existing syntax and/or github.com/nicksnyder/go-i18n already handle some of these cases?
Need further investigation and thinking.

See also gohugoio/hugoDocs#461

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions