learnlatex / learnlatex.github.io

Learn LaTeX online
https://www.learnlatex.org/
Creative Commons Attribution Share Alike 4.0 International
151 stars 54 forks source link

Chinese translation #77

Open stone-zeng opened 4 years ago

stone-zeng commented 4 years ago

Hi!

I'm pleased to contribute a Chinese translation for learnlatex. For better community support, I would like to fork this repo into CTeX-org (see CTeX-org/learnlatex.github.io).

Something need to mention here:

davidcarlisle commented 4 years ago

Hi thanks, you may also be interested in the discussion at

https://github.com/learnlatex/learnlatex.github.io/issues/72#issuecomment-665767969

on whether to translate the examples or leave them in English.

In either case support will be needed for the language-specific examples.

On your bullet points

stone-zeng commented 4 years ago

Can you clarify the Copyright issue.

In texlive there is already an open-source chinese font (fandol), but unfortunately it lacks some rare-used characters, so in some cases one may need to use the system fonts such as simsun/microsoft yahei on windows, pingfang/songti sc on macos, etc. But for the usage of a tutorial, I think this font should be enough and it may not be a big problem.

Can you say what you think would be the most natural designations if we had two Chinese variants?

I think is zh-Hans for simplified and zh-Hant for traditional (I'm still not sure if I should use -Hans or -hans).

davidcarlisle commented 4 years ago

@stone-zeng thanks. On fonts, yes I found fandol worked for my minimal example at

https://www.learnlatex.org/en/lesson-14#the-unicode-era

but I didn't realise it was the only one. Overleaf and latexcgi.xyz are both running on linux so if there is a system font that works on Overleaf but does not work at latexcgi I should be able to install it there (although the disk is getting full) let me know, But if you can manage with fandol for these simple examples that is even easier:-)

on names yes I gather that the choices are zh-CN (for China) or zh-Hans (for Simplified Script) with the latter being preferred in this sort of context eg https://en.wikipedia.org/wiki/IETF_language_tag#ISO_3166-1_and_UN_M.49 so let's go with that (I will fix up the Javascript so the language switcher works)

davidcarlisle commented 4 years ago

The Overleaf help page

https://www.overleaf.com/learn/latex/chinese

Shows that you can use either of these in addition to fandol at Overleaf

\setCJKmainfont{BabelStone Han}
\setCJKsansfont{Noto Sans CJK SC}

Neither works at latexcgi.xyz at present but if you need one of them let me know, and I'll see what I can do,

davidcarlisle commented 4 years ago

Fandol Song and BabelStone Han both now work at the LaTeX CGI server for luatex and xetex.

https://davidcarlisle.github.io/latexcgi/test3

stone-zeng commented 4 years ago

Thanks for your help!

More details about the font:

davidcarlisle commented 4 years ago

OK hopefully for the tutorial these two will be enough, although as I say I could add more. But being open source and also available on Overleaf is really a requirement as it would be good if all examples on the site worked on both systems.

Currently at latexcgi.xyz I have

$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.7G  7.1G  630M  92% /

so each font eats a reasonable fraction of my available disk space (actually there are a couple of archived linux kenel versions that I could delete if space gets really tight, but..)

Longer term may move the latexcgi.xyz server to a bigger machine but that is what it is just now.

Hopefully you can use Fandol for most of the examples and perhaps a BabelStone Han example to show font switching and then will not need any more fonts in actual examples.

davidcarlisle commented 4 years ago

Language switching now works for longer language codes (Jekyll/liquid string handling is weird:-)

https://www.learnlatex.org/zh-Hans/

stone-zeng commented 4 years ago

The CONTRIBUTING.md says:

Please wrap source lines to keep them below 80 characters long.

But for chinese (maybe japanese is the same?) language, line wrap in markdown files will lead to an extra space. So I simply put everything of a paragraph in s single line.

davidcarlisle commented 4 years ago

@stone-zeng Sure, we were not thinking of Chinese requirements, sorry. Do whatever you need and we will fix up the instructions.

stone-zeng commented 4 years ago

And for the emphasis (_xxx_ in markdown), since chinese fonts usual do not contain italic shape (actually italic is not commonly used with cjk scripts), I plan to use strong (**xxx**) instead. I'm not sure whether it's ok, or maybe we can change the style of emph for cjk (e.g. underdot, but personally I don't like it and it's rarely seen on web).

josephwright commented 4 years ago

@stone-zeng One for @jonasjacek? This must be a known issue in web development.

jonasjacek commented 4 years ago

And for the emphasis (_xxx_ in markdown), since chinese fonts usual do not contain italic shape (actually italic is not commonly used with cjk scripts), I plan to use strong (**xxx**) instead. I'm not sure whether it's ok, or maybe we can change the style of emph for cjk (e.g. underdot, but personally I don't like it and it's rarely seen on web).

There are semantic differences between em, strong and i and b. Which to apply depends on the content. I am preparing different styles and also plain CSS classes. We will have to apply HTML elements correctly to achieve a maximum of web content accessibility (also see WCAG). For now you can use what you want. Be prepared, I might change it later.

davidcarlisle commented 3 years ago

Thank you for working on learnlatex.org translations. You may have seen already if watching the repository but just a note to say that we have extended lesson-06 and more-06 to add descriptions of defining commands with \newcommand and \NewDocumentCommand

https://github.com/learnlatex/learnlatex.github.io/commit/463d181301d667b10bf23c164f9d5ae15371877e

jonasjacek commented 3 years ago

@stone-zeng - Regarding the text-level semantics, feel free to use whatever you want. Bold and italic are available. If you need more styles or adjustments, let me know.

There is this ticket for me: https://github.com/learnlatex/learnlatex.github.io/projects/1#card-53136775 - It's about using /zh-hans/ instead of just /zh/ for the directory structure.

I did change it during the design process. I had not read this thread in its entirety. So, is it more correct to use /zh-hans/ than just /zh/? Should I change it back?

davidcarlisle commented 3 years ago

As you may have seen, the main site at learnlatex.org has been given a new design and some of the details of the language data have changed.

If you are still working on the translation, I have updated https://www.learnlatex.org/TRANSLATIONS to hopefully give correct instructions for the new layout, but if anything is not clear please ask

stone-zeng commented 3 years ago

Hi! I have noticed the new design and I will check these updates (and pick up the translations) in recent days.

davidcarlisle commented 3 years ago

@stone-zeng in this PR to the Japanese translation

https://github.com/wtsnjp/learnlatex.github.io/pull/1

I have set up so that _ (emphasis) and ** (strong) use weight 400 and 700 respectively with Noto Sans JP.

We could of course set up similar configuration for Chinese. The Noto Sans SC font appears to be available in exactly the same weights as Noto Sans JP.