learnlatex / learnlatex.github.io

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

Japanese translation #69

Open wtsnjp opened 4 years ago

wtsnjp commented 4 years ago

Following the instruction in TRANSLATIONS.md, I am happy to open this issue to announce that I have just started the Japanese translation. You can find the translation and its up-to-dated progress in the translation-ja branch of my folk.

Since the translation progress is too little for now (right now headings only), I haven't yet set up for the github-pages at this point. When I prepare a live test site so that to make people easily check for the translation, I will notify the URL in this thread. I hope this way works fine for you.

I am looking forward to working further with you 😄

davidcarlisle commented 4 years ago

Thanks a lot.

I should say that there are some Japanese examples already on the site, but they were just me checking that (u)platex was supported at the various back ends being used. Feel free to discard them when you get to those pages.

wtsnjp commented 4 years ago

I got it. I appreciate you and all the people involved to make (u)platex available on the backends.

davidcarlisle commented 4 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

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

wtsnjp commented 3 years ago

Although the progress is slow, I am still working on this Japanese translation. Now I completed “literal” translation for all 16 main lessons (lesson-XX), and so started to host the demo site: https://wtsnjp.github.io/learnlatex.github.io/ja/

The content is still unsuitable for pLaTeX users, and that makes the translation too premature to be read by actual readers. I will continue working on further adjustment of explanations for pLaTeX and also the translation for other contents such as “More on this topic” (more-XX).

davidcarlisle commented 3 years ago

@wtsnjp Thanks for the status update.

Yes we'll need to leave it to you to a certain extent on how literal the translation needs to be. The "spirit" should be that it is the same course, translated, not a different course, but it also has to be useful to the readers...

At one extreme you could make it a Japanese language course on how to write English LaTeX documents, and leave all the platex specifics to language-xxx lessons at the end, but that might be too extreme.

If you switch the examples to Japanese using platex then you will naturally have to adjust the text in some places and use your judgement on how much to change the text.

You don't have to do the same for all examples: you can have some examples using pdftex and some in platex (or both) if you need to show the differences..

がんばろう!

(Hope that means something:-)

davidcarlisle commented 3 years ago

Oh I see you have translated the examples mostly. That's fine they should work at texlive.net and at Overleaf if you add

% !TeX platex

at the top of each. If you need fonts installing at TeXLive.net let me know we have a lot more space available than on my original aws trial host so adding new fonts is not a problem.

test

wtsnjp commented 3 years ago

Yes. I tested all of the examples with my local platex but have not yet tested with online systems. I noticed that I need to add the magic comments to the pLaTeX examples (most of all examples) and plan to do so.

Today I realize that there is a new "Setting" page on the website. Any possibility to change the default "Default Engine" to another engine from pdfLaTeX for a specific language?

davidcarlisle commented 3 years ago

Any possibility to change the default "Default Engine" to another engine from pdfLaTeX for a specific language?

I knew you were going to ask that:-)

Currently not really: the "settings page" is personal settings and disabled by default as uses cookies. but the default default is only set in one place in assets/scripts/runlatex.js

var rldefaultengine=getCookie('runlatex-engine');
if(rldefaultengine=="") rldefaultengine="pdflatex";

I'm not sure I want to make that variable (it complicates the site description a bit if you can't tell by looking which engine will be used) but I can see it might make the translations look nicer (@josephwright any thoughts??)

I think all you would need to do is change the above to

var rldefaultengine=getCookie('runlatex-engine');
if(rldefaultengine=="") {
 if(runlatex.defaultengine==null) {
   rldefaultengine="pdflatex";
 } else {
   rldefaultengine=runlatex.defaultengine;
}
}

Then put

runlatex.defaultengine="platex";

in ja/include/buttons.js

You could try that in your fork:-)

davidcarlisle commented 3 years ago

The code above doesn't work actually, the timing is wrong, but this simpler scheme works, you can put

var rldefaultengine=getCookie('runlatex-engine');
if(rldefaultengine=="") rldefaultengine="platex";

at the end of ja/buttons.js and that will work without changing runlatex.js at all.

You can try the examples here:

https://davidcarlisle.github.io/learnlatex.github.io/ja/help

The first has a !TeX comment and the second does not. Conversely I have added a %!TeX pdflatex comment to the English example on that page (although that simple case works with platex as well)

wtsnjp commented 3 years ago

Thank you very much for that! It is great because it can be all done within the "ja" subtree. I will definitely try it.

davidcarlisle commented 3 years ago

one reason having the comments may be simpler....

The above code makes it use platex unless the user has set a preference for something else, but that means if the user has (say) lualatex set as default for the rest of the site the ja pages will fail. It might be better not to look at the cookie and to just have unconditional

rldefaultengine="platex";

which would work the same way as having a platex comment on every page and use platex even if cookies have been set.

wtsnjp commented 3 years ago

The above code makes it use platex unless the user has set a preference for something else, but that means if the user has (say) lualatex set as default for the rest of the site the ja pages will fail.

Well, but if one set "default engine", then I feel it natural to fail running the examples, which are for platex, without explicit ! TEX comment. Isn't the user who set it by cookies responsible for that?

One small concern is that it still shows "pdfLaTeX" as the default engine in the option menu on ja/setting page, while the actual default engine is "pLaTeX" in this case.

davidcarlisle commented 3 years ago

well as I say it needs documenting...

currently there is only one setting for the whole site (the cookies have scope for the root of the website) so the ja/settings page is setting the same things as the en/settings page, just the text is translated (or will be) However you might expect that the menus start off selecting the current (Japanese) defaults

the menu is supposed to start with the current value of rldefaultengine

(v==rldefaultengine ? " selected

so I'll have a look why that isn't happening,

davidcarlisle commented 3 years ago

@wtsnjp ah:

{% if page.path contains "-" or page.path contains "help" %}

so the settings page doesn't read the localised buttons.js

Fixed on my fork:

https://github.com/davidcarlisle/learnlatex.github.io/commit/1df8aab13c3a03cddd01b7f7137c5131a6f6a4b6

https://davidcarlisle.github.io/learnlatex.github.io/ja/settings shows platex on the engine menu even when cookies are disabled

wtsnjp commented 3 years ago

Thanks again for finding the solution.

well as I say it needs documenting...

Ah, now I see. I will mention the ja-specific behavior in ja/setting. Hope that is sufficient.

davidcarlisle commented 3 years ago

The rest of the site is using noto sans for most text, but the ones that we have installed locally don't cover Japanese so the ja pages are picking up whatever font is installed locally

I added one of your pages to my fork and experimented a bit with using google font server as a fallback after trying the fonts served from texlive.net

https://davidcarlisle.github.io/learnlatex.github.io/ja/lesson-11

As I can't read it anyway it's hard for me to judge if that is reasonable. if you do want to use noto sans, probably the assignment of the weights could be more careful I just got google fonts API to generate three weights here, as an experiment (actually I think I'm only using the regular weight, but enough for tonight)

The change to the css is

https://github.com/davidcarlisle/learnlatex.github.io/commit/8471da5bae8e113ddb90710d6225178d5c0c8746#diff-cd886530abfa495dc6782189ca779f1304bb73bc1758e5d3f0968448dfb67abe

and a couple of commits after that to catch more of the css classes used on my test page

davidcarlisle commented 3 years ago

is

レッスン 11

OK or would you rather have localised digits?

In _includes/toc-lessons.html and _layouts/lesson.html (I should make them share code:-) You will see some code to get Marathi digits, you could add the same for Japanese (it just requires an array of the numbers 0-20).

so you get

प्रकरण ११

at

https://www.learnlatex.org/mr/lesson-11

wtsnjp commented 3 years ago

I added one of your pages to my fork and experimented a bit with using google font server as a fallback after trying the fonts served from texlive.net

https://davidcarlisle.github.io/learnlatex.github.io/ja/lesson-11

As I can't read it anyway it's hard for me to judge if that is reasonable. if you do want to use noto sans, probably the assignment of the weights could be more careful I just got google fonts API to generate three weights here, as an experiment (actually I think I'm only using the regular weight, but enough for tonight)

I personally think this fallback is a nice idea. Your demo page looks already fine to me, but I am not a professional web designer nor a typographer, so I am currently consulting with some Japanese TeX experts.

wtsnjp commented 3 years ago

is

レッスン 11

OK or would you rather have localised digits?

Thanks for the tip. But in our case "レッスン 11" (with Arabic numbers) is quite fine. (on the other hand, it is rather preferred to use Kanji to represent numbers when making documents in the vertical direction (i.e., tate-gumi; 縦組み))

wtsnjp commented 3 years ago

As the Chinese translator mentioned before, using Italic shape to emphasize texts is not common for CJK languages. So, I am also using <strong> (**text** in Markdown) instead of <em> (_text_) in Japanese translation.

I noticed that <strong> are not working well at least in my browser. For instance, in the following case, “TeX システム” (TeX system) are in the <strong> tag but only the “システム” part in Japanese letters are in bold.

Screen Shot 2021-04-30 at 14 51 35

In another example, even Japanese letters (the “後に” part in the below) are not in the bold style. Is this a known issue?

Screen Shot 2021-04-30 at 14 52 14

davidcarlisle commented 3 years ago

@wtsnjp this is actually related to the noto sans comment I made earlier. I should probably make another attempt this weekend of setting up the fonts. Currently the fonts specified don't cover Japanese so your browser CSS engine will use whichever font it finds that has the characters. Then whether that font has a bold or italic variant installed is all a bit arbitrary and depends on the machine you use to view the site and what fonts it has.

If we set up the noto sans cjk fonts correctly then we will have a known set of variants and can set up the fonts even without you changing the markup. That is, if italic doesn't make sense we can specify that css class uses bold without changing the markdown.

davidcarlisle commented 3 years ago

@wtsnjp I may have over-done the contrast a bit, but does this look readable (I honestly can't really tell)

https://davidcarlisle.github.io/learnlatex.github.io/ja/lesson-09#label-%E3%82%92%E7%BD%AE%E3%81%8F%E4%BD%8D%E7%BD%AE

I went a step further than my attempt in the comment above, rather than offering the Noto Sans JP font just as a fallback I switch the stylesheet to use a style-ja.sccs which gives more flexibility to adjust weights and sizes.

I added your fork as another upstream to my fork and am building the gh-pages the translation-ja branch. So if this looks at all reasonable I can easily make a PR back to your fork.

I haven't done the monospace font used by the editor and have only done the lesson template not the non-lesson pages template, but I thought I'd let you see the attempt so far.

davidcarlisle commented 3 years ago

sorry something not right, it's gone back to my local yu Gothic font in most places, probably I broke the css. Enough for tonight though.

wtsnjp commented 3 years ago

Thanks a lot for your help. Though I haven't yet checked everything, your fork looks far better than before :+1:

I added your fork as another upstream to my fork and am building the gh-pages the translation-ja branch. So if this looks at all reasonable I can easily make a PR back to your fork.

This is much helpful for me. I also wonder how we apply the previous matters (i.e., the changes for default "default engine" for ja translation).

I occasionally merge learnlatex:main to my translation-ja branch anyway, so just putting those updates in the original repository will work fine too.

davidcarlisle commented 3 years ago

I also wonder how we apply the previous matters (i.e., the changes for default "default engine" for ja translation).

That should happen automatically if when you make a PR to add Japanese to the main site, you have the default setting in ja/buttons.js it should "just work"

PR to @wtsnjp fork at https://github.com/wtsnjp/learnlatex.github.io/pull/1

wtsnjp commented 3 years ago

Thanks for the pull request. I merged and confirmed it works. I will update style-ja.scss further on my side if necessary.

I also wonder how we apply the previous matters (i.e., the changes for default "default engine" for ja translation).

That should happen automatically if when you make a PR to add Japanese to the main site, you have the default setting in ja/buttons.js it should "just work"

I meant this one (https://github.com/davidcarlisle/learnlatex.github.io/commit/1df8aab13c3a03cddd01b7f7137c5131a6f6a4b6). This change is not under the ja directory, so it can be a cause of conflict in the future, but should I commit this to my fork anyway?

davidcarlisle commented 3 years ago

@wtsnjp ah sorry yes, that will be fine add it on your side then you can test it. I don't need to worry about merge conflicts in my fork, it is a "throw away" repository for testing things. If it is not easy to resolve conflicts I just discard it and re-fork from the head of the main site.