summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunseong Park2024-12-14 22:07:47 +0900
committerGitHub2024-12-14 14:07:47 +0100
commit393dcf23f695661e5b4b3dd665a4aecc7834cea3 (patch)
treeb6b4ebbfc2bebe23c04019b2c543b62c2644a4bd
parent5947f910d8419b59a3364db4f340d4976eb3b8cb (diff)
downloadIT.starlight-393dcf23f695661e5b4b3dd665a4aecc7834cea3.tar.gz
IT.starlight-393dcf23f695661e5b4b3dd665a4aecc7834cea3.tar.bz2
IT.starlight-393dcf23f695661e5b4b3dd665a4aecc7834cea3.zip
i18n(ko-KR): update `i18n.mdx` (#2674)
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
-rw-r--r--docs/src/content/docs/ko/guides/i18n.mdx29
1 files changed, 15 insertions, 14 deletions
diff --git a/docs/src/content/docs/ko/guides/i18n.mdx b/docs/src/content/docs/ko/guides/i18n.mdx
index 612a9778..11f653c3 100644
--- a/docs/src/content/docs/ko/guides/i18n.mdx
+++ b/docs/src/content/docs/ko/guides/i18n.mdx
@@ -66,7 +66,7 @@ Starlight๋Š” ๋ผ์šฐํŒ…, ๋Œ€์ฒด ์ฝ˜ํ…์ธ  ๋ฐ ์ „์ฒด RTL(์˜ค๋ฅธ์ชฝ์—์„œ ์™ผ์ชฝ์œ
</Steps>
-๊ณ ๊ธ‰ ๊ตญ์ œํ™” ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ์œ„ํ•ด Starlight๋Š” [Astro์˜ `i18n` ๊ตฌ์„ฑ](https://docs.astro.build/ko/guides/internationalization/#i18n-%EB%9D%BC%EC%9A%B0%ED%8C%85-%EA%B5%AC%EC%84%B1) ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋Š” ๊ตญ์ œํ™” ๊ตฌ์„ฑ๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
+๊ณ ๊ธ‰ ๊ตญ์ œํ™” ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ์œ„ํ•ด Starlight๋Š” [Astro์˜ `i18n` ๊ตฌ์„ฑ](https://docs.astro.build/ko/guides/internationalization/#i18n-๋ผ์šฐํŒ…-๊ตฌ์„ฑ) ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋Š” ๊ตญ์ œํ™” ๊ตฌ์„ฑ๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
### ๋ฃจํŠธ ๋กœ์ผ€์ผ ์‚ฌ์šฉ
@@ -189,16 +189,16 @@ Starlight๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฒˆ์—ญ๋œ ์ฝ˜ํ…์ธ  ํŒŒ์ผ์„ ํ˜ธ์ŠคํŒ…ํ•˜๋Š” ๊ฒƒ ์™ธ์
<Steps>
-1. ์•„์ง ๊ตฌ์„ฑ๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ `src/content/config.ts`์—์„œ `i18n` ๋ฐ์ดํ„ฐ ์ปฌ๋ ‰์…˜์„ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.
+1. ์•„์ง ๊ตฌ์„ฑ๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ `src/content.config.ts`์—์„œ `i18n` ๋ฐ์ดํ„ฐ ์ปฌ๋ ‰์…˜์„ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.
- ```diff lang="js" ins=/, (i18nSchema)/
- // src/content/config.ts
- import { defineCollection } from 'astro:content';
+ ```diff lang="js" ins=/, (i18nLoader|i18nSchema)/
+ // src/content.config.ts
+ import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
export const collections = {
- docs: defineCollection({ schema: docsSchema() }),
- + i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
+ + i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }),
};
```
@@ -256,14 +256,15 @@ Starlight๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฒˆ์—ญ๋œ ์ฝ˜ํ…์ธ  ํŒŒ์ผ์„ ํ˜ธ์ŠคํŒ…ํ•˜๋Š” ๊ฒƒ ์™ธ์
๋‹ค์Œ ์˜ˆ์‹œ์—์„œ๋Š” ๊ธฐ๋ณธ ํ‚ค์— ์ƒˆ๋กœ์šด ์„ ํƒ์  `custom.label` ํ‚ค๊ฐ€ ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค.
```diff lang="js"
-// src/content/config.ts
+// src/content.config.ts
import { defineCollection, z } from 'astro:content';
+import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
export const collections = {
- docs: defineCollection({ schema: docsSchema() }),
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
i18n: defineCollection({
- type: 'data',
+ loader: i18nLoader(),
schema: i18nSchema({
+ extend: z.object({
+ 'custom.label': z.string().optional(),
@@ -273,14 +274,14 @@ export const collections = {
};
```
-Astro ๊ณต์‹๋ฌธ์„œ์˜ ["์ปฌ๋ ‰์…˜ ์Šคํ‚ค๋งˆ ์ •์˜"](https://docs.astro.build/ko/guides/content-collections/#defining-a-collection-schema)์—์„œ ์ฝ˜ํ…์ธ  ์ปฌ๋ ‰์…˜ ์Šคํ‚ค๋งˆ์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด์„ธ์š”.
+Astro ๊ณต์‹๋ฌธ์„œ์˜ ["์ปฌ๋ ‰์…˜ ์Šคํ‚ค๋งˆ ์ •์˜"](https://docs.astro.build/ko/guides/content-collections/#์ปฌ๋ ‰์…˜-์Šคํ‚ค๋งˆ-์ •์˜)์—์„œ ์ฝ˜ํ…์ธ  ์ปฌ๋ ‰์…˜ ์Šคํ‚ค๋งˆ์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด์„ธ์š”.
## UI ๋ฒˆ์—ญ ์‚ฌ์šฉ
Starlight์˜ [๊ธฐ๋ณธ ์ œ๊ณต UI ๋ฌธ์ž์—ด](/ko/guides/i18n/#starlight-ui-๋ฒˆ์—ญ)๊ณผ [์‚ฌ์šฉ์ž ์ •์˜](/ko/guides/i18n/#๋ฒˆ์—ญ-์Šคํ‚ค๋งˆ-ํ™•์žฅ) ๋ฐ [ํ”Œ๋Ÿฌ๊ทธ์ธ ์ œ๊ณต](/ko/reference/plugins/#injecttranslations) UI ๋ฌธ์ž์—ด์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋Š” ํ†ตํ•ฉ API๋Š” [i18next](https://www.i18next.com/)๋กœ ๊ตฌ๋™๋ฉ๋‹ˆ๋‹ค.
์—ฌ๊ธฐ์—๋Š” [๋ณด๊ฐ„](https://www.i18next.com/translation-function/interpolation) ๋ฐ [๋ณต์ˆ˜ํ™”](https://www.i18next.com/translation-function/plurals)์™€ ๊ฐ™์€ ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์ง€์›์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
-Astro ์ปดํฌ๋„ŒํŠธ์—์„œ ์ด API๋Š” [์ „์—ญ `Astro` ๊ฐ์ฒด](https://docs.astro.build/ko/reference/api-reference/#astrolocals)์˜ ์ผ๋ถ€์ธ `Astro.locals.t`๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
+Astro ์ปดํฌ๋„ŒํŠธ์—์„œ ์ด API๋Š” [์ „์—ญ `Astro` ๊ฐ์ฒด](https://docs.astro.build/ko/reference/api-reference/#locals)์˜ ์ผ๋ถ€์ธ `Astro.locals.t`๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
```astro title="example.astro"
<p dir={Astro.locals.t.dir()}>
@@ -288,7 +289,7 @@ Astro ์ปดํฌ๋„ŒํŠธ์—์„œ ์ด API๋Š” [์ „์—ญ `Astro` ๊ฐ์ฒด](https://docs.astro.b
</p>
```
-[์—”๋“œํฌ์ธํŠธ](https://docs.astro.build/ko/guides/endpoints/)์—์„œ๋„ API๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์—ฌ๊ธฐ์„œ `locals` ๊ฐ์ฒด๋Š” [์—”๋“œํฌ์ธํŠธ ์ปจํ…์ŠคํŠธ](https://docs.astro.build/ko/reference/api-reference/#contextlocals)์˜ ์ผ๋ถ€๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
+[์—”๋“œํฌ์ธํŠธ](https://docs.astro.build/ko/guides/endpoints/)์—์„œ๋„ API๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์—ฌ๊ธฐ์„œ `locals` ๊ฐ์ฒด๋Š” [์—”๋“œํฌ์ธํŠธ ์ปจํ…์ŠคํŠธ](https://docs.astro.build/ko/reference/api-reference/#locals)์˜ ์ผ๋ถ€๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
```ts title="src/pages/404.ts"
export const GET = (context) => {
@@ -389,7 +390,7 @@ const arabicDirection = Astro.locals.t.dir('ar');
## ํ˜„์žฌ ๋กœ์ผ€์ผ์— ์•ก์„ธ์Šค
-[`Astro.currentLocale`](https://docs.astro.build/ko/reference/api-reference/#astrocurrentlocale)์„ ์‚ฌ์šฉํ•˜์—ฌ `.astro` ์ปดํฌ๋„ŒํŠธ์˜ ํ˜„์žฌ ๋กœ์ผ€์ผ์„ ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
+[`Astro.currentLocale`](https://docs.astro.build/ko/reference/api-reference/#currentlocale)์„ ์‚ฌ์šฉํ•˜์—ฌ `.astro` ์ปดํฌ๋„ŒํŠธ์˜ ํ˜„์žฌ ๋กœ์ผ€์ผ์„ ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋‹ค์Œ ์˜ˆ์‹œ๋Š” ํ˜„์žฌ ๋กœ์ผ€์ผ์„ ์ฝ๊ณ  ์ด๋ฅผ [`getRelativeLocaleUrl()`](https://docs.astro.build/ko/reference/modules/astro-i18n/#getrelativelocaleurl) ํ—ฌํผ์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜์—ฌ ํ˜„์žฌ ์–ธ์–ด๋กœ ๋œ ์†Œ๊ฐœ ํŽ˜์ด์ง€ ๋งํฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค: