-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
i18n(ja): Update client-side-scripts.mdx #7004
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
Merged
yanthomasdev
merged 2 commits into
withastro:main
from
morinokami:i18n-ja-client-side-scripts-0
Feb 24, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ description: >- | |
| Astroコンポーネントに追加する方法 | ||
| i18nReady: true | ||
| --- | ||
| import ReadMore from '~/components/ReadMore.astro' | ||
|
|
||
| 標準的なHTMLの`<script>`タグを使用すれば、React・Svelte・Vue等の[UIフレームワーク](/ja/guides/framework-components/)を利用せずにインタラクティブ性をAstroコンポーネントへ追加できます。これによってブラウザ上で実行されるJavaScriptを送信してAstroコンポーネントに機能を追加できるようになります。 | ||
|
|
||
|
|
@@ -88,7 +89,7 @@ Astroがスクリプトを処理しないようにするには、`is:inline`デ | |
| Astroは、状況によってはスクリプトタグを処理しません。特に、`<script>`タグに`type="module"`や`src`以外の属性を追加すると、Astroはそのタグを`is:inline`ディレクティブがあるかのように扱います。スクリプトがJSX式で記述されている場合も同様です。 | ||
| ::: | ||
|
|
||
| 📚 `<script>` タグで利用可能なディレクティブについてもっと知りたい場合は、[テンプレートディレクティブ](/ja/reference/directives-reference/#script--style-directives)を参照してください。 | ||
| <ReadMore>`<script>` タグで利用可能なディレクティブについてもっと知りたい場合は、[ディレクティブリファレンス](/ja/reference/directives-reference/#script--style-directives)ページを参照してください。</ReadMore> | ||
|
|
||
| ### ページにJavaScriptファイルを含める | ||
|
|
||
|
|
@@ -190,7 +191,7 @@ Webコンポーネント標準を使うことで独自の動作をするHTML要 | |
| 1. `document.querySelector()`を使って全ページを検索する変わりに、`this.querySelector()`を使えば検索範囲が現在のカスタム要素のインスタンスに限られます。これにより、一回で一つのコンポーネントだけを操作しやすくなります。 | ||
| 2. `<script>`は一度だけしか実行されませんが、ブラウザはページ上の`<astro-heart>`を見つける度にカスタム要素の`constructor()`メソッドを実行します。これにより、ページで複数回コンポーネントを使用する場合でも一つのコンポーネントを安全に記述できます。 | ||
|
|
||
| 📚 [web.dev’s Reusable Web Components guide](https://web.dev/custom-elements-v1/)と[MDN’s introduction to custom elements](https://developer.mozilla.org/ja/docs/Web/Web_Components/Using_custom_elements)から多くのカスタム要素について学ぶことができます。 | ||
| <ReadMore>[web.devの再利用可能なウェブコンポーネントガイド](https://web.dev/articles/custom-elements-v1?hl=ja)と[MDNのカスタム要素の紹介](https://developer.mozilla.org/ja/docs/Web/Web_Components/Using_custom_elements)で、カスタム要素について詳しく学べます。</ReadMore> | ||
|
Comment on lines
-193
to
+194
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. こちらも「多くのカスタム要素について」などは誤訳に近い感じだったため、訳文の微調整を加えています。英語版はこちら:
|
||
|
|
||
| ### フロントマター変数をスクリプトに渡す | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本来の差分は
<ReadMore>タグの追加だけなのですが、英語版と見比べて少し訳がおかしかったため、訳文自体に微調整も加えています。英語版の文章は以下となります: