Skip to content

x/pkgsite: specifying a file's language #6893

@siritinga

Description

@siritinga
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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions