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

x/tools/cmd/godoc: specifying a file's language #6893

Open
siritinga opened this Issue Dec 4, 2013 · 5 comments

Comments

Projects
None yet
5 participants
@siritinga

siritinga commented Dec 4, 2013

Go source files are UTF-8 so there is, in principle, no need to specify its encoding or
language. However, I think there is one case when it would be very convenient to specify
in which language are the comments written.

When using CJK (Chinese, Japanese and Korean), there are different variations of some
ideograms that are written with different glyphs (sometimes differences are minor,
sometimes not so minor). However, in Unicode, some of these varied glyphs share the same
codepoint, so it is not possible to choose the right glyph if the language is unknown.
This is called the Han Unification: https://en.wikipedia.org/wiki/Han_unification

HTML code can include the <lang> label to inform the browser which font should it
use to render a text. If it is not included, the browser usually will use a default
font. For example, Google Chrome on a non-CJK system will usually choose a Chinese font,
and Japanese ideograms will be rendered with Chinese glyphs.

So my suggestion would be to include some kind of label for godoc to include the right
<lang> label in the HTML generated, so it will be rendered correctly in most
systems. 

Ideally, it should be possible to modify it inside a file, so you could write Chinese
and Japanese in the same file.

What do you think?
@adg

This comment has been minimized.

Contributor

adg commented Dec 4, 2013

Comment 1:

One possibility is to add some kind of magic comment:
// +language foo
But it would be non-trivial to implement this.
Got an example of this causing a real problem?

Status changed to Thinking.

@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Dec 4, 2013

Comment 3:

Side note: I think we probably eventually want a general scheme for comments that affect
godoc, so that a package can present itself in an order that makes more sense.
@minux

This comment has been minimized.

Member

minux commented Dec 5, 2013

Comment 4:

Labels changed: added repo-tools.

@siritinga

This comment has been minimized.

siritinga commented Dec 5, 2013

Comment 5:

I've searched in godoc for repositories with Japanese documentation for a real case. For
example http://godoc.org/github.com/yokano/escape3ds/server/view contains Japanese
comments that are rendered in Chinese in my computer. There is no <lang> label so
it is up to the browser. Honestly, with my limited Japanese I only found one ideogram
rendered incorrectly in that package (終), but the issue is present.
@rsc

This comment has been minimized.

Contributor

rsc commented Mar 3, 2014

Comment 6:

Labels changed: added release-none.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed the release-none label Apr 10, 2015

@rsc rsc changed the title from cmd/godoc: specifying a file's language to x/tools/cmd/godoc: specifying a file's language Apr 14, 2015

@rsc rsc removed the repo-tools label Apr 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment