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

i18n(ja): Update configuring-astro.md #2137

Merged
merged 2 commits into from
Dec 6, 2022

Conversation

morinokami
Copy link
Contributor

What kind of changes does this PR include?

  • Translated content

Description

  • Update configuring-astro.md.

@netlify
Copy link

netlify bot commented Dec 5, 2022

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b2546d0
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/638f6afa5b5a16000828ee37
😎 Deploy Preview https://deploy-preview-2137--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help! label Dec 5, 2022
Comment on lines +122 to +145
## 出力するファイル名のカスタマイズ

インポートしたJavaScriptやCSSファイルなど、Astroが処理するコードについては、`astro.config.*`ファイルの`vite.build.rollupOptions`で[`entryFileNames`](https://rollupjs.org/guide/en/#outputentryfilenames)、[`chunkFileNames`](https://rollupjs.org/guide/en/#outputchunkfilenames)、[`assetFileNames`](https://rollupjs.org/guide/en/#outputassetfilenames)を用いて出力するファイル名をカスタマイズできます。

```js ins={9-11}
// astro.config.mjs
import { defineConfig } from 'astro/config'

export default defineConfig({
vite: {
build: {
rollupOptions: {
output: {
entryFileNames: 'entry.[hash].js',
chunkFileNames: 'chunks/chunk.[hash].js',
assetFileNames: 'assets/asset.[hash][extname]',
},
},
},
},
})
```

これは、広告ブロッカーの影響を受ける可能性のある名前のスクリプト(たとえば`ads.js`や`google-tag-manager.js`)がある場合に役に立ちます。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#931 にて追加されたセクションです。

@@ -24,14 +24,14 @@ export default defineConfig({

`defineConfig()`を使うと、IDEで自動的にタイプヒントを表示できるのでおすすめですが、これはオプションです。最低限必要で、有効な設定ファイルは次のようなものです。

```js
```js title="astro.config.mjs"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

この行やこれ以下で登場する、ファイル名を指定するタイプの修正は #1135 にておこなわれています。

Comment on lines +81 to 87
// astro.config.mjs
import { defineConfig } from 'astro/config'

export default defineConfig({
// 現在の作業ディレクトリにある "./foo"ディレクトリを指します。
root: 'foo'
// 現在の作業ディレクトリにある "./foo"ディレクトリを指します。
root: 'foo'
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

defineConfig のインポートとインデントの修正も #1135 にておこなわれたものです。

Comment on lines -100 to +106
```js
```js "import.meta.url"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1175 に対応しています。

Astroは、JavaScriptの設定ファイルとして、次のようないくつかのファイル形式をサポートしています。 `astro.config.js`,`astro.config.mjs`,`astro.config.cjs`,`astro.config.ts`
Astroは、JavaScriptの設定ファイルとして、`astro.config.js``astro.config.mjs``astro.config.cjs``astro.config.ts`という複数のファイル形式をサポートしています。多くの場合は`.mjs`を、設定ファイルをTypeScriptで記述する場合は`.ts`を使用することをおすすめします。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1514 にて "We recommend using .mjs in most cases or .ts if you want to write TypeScript in your config file." という文が追加されたため、対応する訳文を追加しました。

また、もとの訳文で "astro.config.js,astro.config.mjs,astro.config.cjs,astro.config.ts" という部分が英語のカンマのままであったり、直前の文と接続していないように思えたため、なるべく自然な日本語となるように修正してみました。

Comment on lines +118 to +120
:::note
`import.meta.env`や`import.meta.glob`など、Vite固有の`import.meta`プロパティは設定ファイルからはアクセスできません。こうしたユースケースについては[dotenv](https://github.com/motdotla/dotenv)や[fast-glob](https://github.com/mrmlnc/fast-glob)などの代替手段をおすすめします。
:::
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1967 にて追加されました。

`root`または`--root`フラグで相対パスを指定すると、`astro`コマンドを実行した現在の作業ディレクトリに反して、指定した相対パスをルートとして使用します
`root`または`--root`フラグで相対パスを指定すると、`astro`コマンドを実行した現在の作業ディレクトリを起点として、指定した相対パスを解決します
Copy link
Contributor Author

Choose a reason for hiding this comment

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

この一文なのですが、原文は

If you provide a relative path to root or the --root CLI flag, Astro will resolve it against the current working directory where you ran the astro CLI command.

となっており、「root で指定された内容 (= it)」を「コマンドを実行した現在の作業ディレクトリに対して (= against the current working directory)」見つけ出すということになると思うのですが、もとの訳文の「反して」だと少し意味が違うように思えたため、「対して」をよりわかりやすくした「起点として」に修正しました。

また、上のように修正した場合、resolve に対応する訳が「ルートとして使用」のままではおかしくなってしまうため、原文に忠実に「解決」という言葉を用いるように変更しています(「名前解決」などの言葉はこの業界では一般的であると思われるため、このように変えても読みづらくはならないと判断しました)。

@morinokami morinokami marked this pull request as ready for review December 5, 2022 14:42
Copy link
Contributor

@kyosuke kyosuke left a comment

Choose a reason for hiding this comment

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

@morinokami 全体を現在の英語版と比較し、また、個別にコメントいただいた内容についても、すべて確認しました。丁寧に修正されていて、またもとの訳文を改善していただいた箇所も素晴らしかったです。LGTM。

@sarah11918 sarah11918 merged commit b4782b8 into withastro:main Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants