Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic conversion between Traditional and Simplified Chinese #4669

Open
anthonyfok opened this issue Apr 25, 2018 · 2 comments
Open

Automatic conversion between Traditional and Simplified Chinese #4669

anthonyfok opened this issue Apr 25, 2018 · 2 comments

Comments

@anthonyfok
Copy link
Member

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

@stale
Copy link

stale bot commented Aug 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Aug 23, 2018
@bep bep added the Keep label Aug 23, 2018
@stale stale bot removed the Stale label Aug 23, 2018
@septs
Copy link
Contributor

septs commented Nov 22, 2022

i think, can add a template function support the feature, like babel handling method

{{ .Content | opencc "s2t" }}

equal to (pseudo-code):

{{ .Content }} | opencc --config "s2t" -- | {{ pipeline return value }}

@anthonyfok anthonyfok self-assigned this May 10, 2023
@jmooring jmooring changed the title [Proposal] Automatic conversion between Traditional and Simplified Chinese Automatic conversion between Traditional and Simplified Chinese Dec 30, 2023
@bep bep removed the Keep label Jan 31, 2024
@bep bep added this to the v0.131.0 milestone Jul 30, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants