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

debugging ページの日本語訳対応の案 #261

Draft
wants to merge 4 commits into
base: i18n/ja
Choose a base branch
from

Conversation

kkeeth
Copy link

@kkeeth kkeeth commented Jul 31, 2023

fix: #35

既存の debugging ページの日本語対応をもしするのであればこれでどうでしょうか?という案出しになりますー

この draft PR の変更に加えて,gitignore に含まれている src/templates/pages/learn/index.hbs を以下のように変更すると一応できるかなーと思います.

  • この対応で,https://p5js.org/learn/ja/debugging.html でアクセスができるようになる
  • 英語の URL にもアクセスすると英語のまま見れるようになる
  • 本家のリポジトリが同ファイルの中身を変えたり URL を変えられると壊れるのが懸念
- <a class="nounderline" href="debugging.html">
+ <a class="nounderline" href="{{#i18n "debugging-url"}}{{/i18n}}debugging.html">
    <img alt="" src="{{assets}}/img/learn/lib_placeholder.jpg">
    <h3>{{#i18n "debugging-title"}}{{/i18n}}</h3>
  </a>

@kkeeth kkeeth requested review from shibomb and Acha0203 July 31, 2023 07:20
@kkeeth kkeeth self-assigned this Jul 31, 2023
Acha0203
Acha0203 previously approved these changes Jul 31, 2023
Copy link

@Acha0203 Acha0203 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM👍

@@ -664,7 +664,7 @@ learn:
getting-started-in-webgl-shaders-p14x1: >-
このようなシンプルなシェーダーは、それ自体で役立つことがありますが、p5.js スケッチからシェーダーに変数を伝達する必要がある場合もあります。
ここでユニフォームが登場します。ユニフォームは、スケッチからシェーダーに送信できる特殊な変数です。
これにより、シェーダーをより制御できるようになります。例えば、p5.js のメソッド <a class="code">millis()</a>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

単にフォーマッターによる余白削除です

@@ -73,7 +73,7 @@ copyright:
copyright-title: Copyright Information
copyright1: >-
The p5.js library is free software; you can redistribute it and/or modify it
under the terms of the
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

単にフォーマッターによる余白削除です

@@ -646,15 +646,15 @@ learn:
以下は、赤色を表示するだけの非常にシンプルなフラグメントシェーダーです:
getting-started-in-webgl-shaders-p10x1: >-
フラグメントシェーダーは、float の 'precision' を指定する行で始まります。この値は、<a
class="code">lowp</a>、<a class="code">mediump</a>、<a class="code">highp</a>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

単にフォーマッターによる余白削除です

のいずれかになりますが、通常は <a class="code">mediump</a> を使用し、特定の状況では <a
class="code">highp</a> を使用することがあります。
getting-started-in-webgl-shaders-p11x1: >-
そして、頂点シェーダーと同様に、フラグメントシェーダーにも <a class="code">main()</a> 関数が必要ですが、<a
class="code">gl_Position</a> ではなく、<a class="code">gl_FragColor</a>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

単にフォーマッターによる余白削除です

に色を割り当てます。
getting-started-in-webgl-shaders-p12x1: >-
変数 <a class="code">myColor</a> は <a class="code">vec4</a>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

単にフォーマッターによる余白削除です

@shibomb
Copy link
Member

shibomb commented Jul 31, 2023

確かに learn は複数ページで構成されるので、 example や reference のようにカテゴリー毎に各言語用のファイルがあった方が管理しやすいですよね!
(しかし、このサイト、ここまでカテゴリー毎にi18n対応がバラバラの仕組みになっているとは思っていませんでした汗)

理想のナイスアイデアなのですが、現実はちょっとサイト自動生成絡みで、ややこしくなりそうな雰囲気です・・・

src/templates/pages/learn/index.hbs

gitignore に含まれている src/templates/pages/learn/index.hbs 

これは下記によって自動生成されているようです
src/data/learn/build.js

ここで使用されているejsテンプレートとデータは
learn.ejs learn.json

ここの自動生成を止めるわけにはいかない気がしますが、
もしかしたら

  "becoming-a-better-programmer-title": [
    {
      "name": "debugging",
      "url": "debugging.html"
    },
  "becoming-a-better-programmer-title": [
    {
      "name": "debugging",
      "url": "{{#i18n 'debugging-url'}}{{/i18n}}debugging.html"
    },

とやっておけば、 自動生成、かつ、他言語対応できるかもしれませんね。

"debugging-url: ja"

あと、commitで気になったのですが、
p5js-i18n-ja/p5.js-website@730f49d
で、自動で
debugging-url: ja/
が消されているように思います。
おそらく、 en版にないものが削除されている(逆に追加されていたら、追加される)という仕組みのようです。
なので、 元ファイルへのキー追加が必須になってきそうです。


別でおっしゃっているのように、ja独自でサイト運営することになったら手を加えるのはありかもです。
(そうなったら、スタイルとかフォント・フォントサイズも全部見直したいですよね!!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update files of learn/debugging for i18n
3 participants