diff options
author | Junseong Park | 2024-12-14 22:07:47 +0900 |
---|---|---|
committer | GitHub | 2024-12-14 14:07:47 +0100 |
commit | 393dcf23f695661e5b4b3dd665a4aecc7834cea3 (patch) | |
tree | b6b4ebbfc2bebe23c04019b2c543b62c2644a4bd | |
parent | 5947f910d8419b59a3364db4f340d4976eb3b8cb (diff) | |
download | IT.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.mdx | 29 |
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) ํฌํผ์ ํจ๊ป ์ฌ์ฉํ์ฌ ํ์ฌ ์ธ์ด๋ก ๋ ์๊ฐ ํ์ด์ง ๋งํฌ๋ฅผ ์์ฑํฉ๋๋ค: |