์ฝ˜ํ…์ธ  ๋Œ€ํ‘œ ์ด๋ฏธ์ง€ - ๐ŸŒ ์›น ๊ตญ์ œํ™” i18n๊ณผ ๋‹ค๊ตญ์–ด ์ง€์› ์™„๋ฒฝ ๊ฐ€์ด๋“œ

๐ŸŒ ์›น ๊ตญ์ œํ™” i18n๊ณผ ๋‹ค๊ตญ์–ด ์ง€์› ์™„๋ฒฝ ๊ฐ€์ด๋“œ

์ „ ์„ธ๊ณ„ ์‚ฌ์šฉ์ž๋ฅผ ์‚ฌ๋กœ์žก๋Š” ๊ธ€๋กœ๋ฒŒ ์›น์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ

๐ŸŒ English ํ•œ๊ตญ์–ด ๆ—ฅๆœฌ่ชž ไธญๆ–‡

๐ŸŽฏ ์™œ i18n์ด ์ค‘์š”ํ• ๊นŒ?

์นœ๊ตฌ์•ผ, ํ˜น์‹œ ํ•ด์™ธ ์‚ฌ์ดํŠธ ๋“ค์–ด๊ฐ”๋‹ค๊ฐ€ ํ•œ๊ธ€ ์ง€์›์ด ์•ˆ ๋ผ์„œ ๋‹นํ™ฉํ•œ ์  ์žˆ์ง€? ๐Ÿ˜… ์•„๋‹ˆ๋ฉด ๋ฒˆ์—ญ์ด ๋„ˆ๋ฌด ์ด์ƒํ•ด์„œ ์›ƒ์Œ์ด ๋‚˜์˜จ ๊ฒฝํ—˜์€? ๋ฐ”๋กœ ๊ทธ๊ฒŒ ๊ตญ์ œํ™”(i18n)๊ฐ€ ์ œ๋Œ€๋กœ ์•ˆ ๋œ ์‚ฌ๋ก€์•ผ.

i18n์€ 'internationalization'์˜ ์ค„์ž„๋ง์ธ๋ฐ, i์™€ n ์‚ฌ์ด์— 18๊ธ€์ž๊ฐ€ ์žˆ์–ด์„œ ์ด๋ ‡๊ฒŒ ๋ถ€๋ฅธ๋Œ€. ์žฌ์น˜์žˆ์ง€? ๐Ÿค“ ์ด๊ฑด ๋‹จ์ˆœํžˆ ์–ธ์–ด๋งŒ ๋ฐ”๊พธ๋Š” ๊ฒŒ ์•„๋‹ˆ๋ผ, ์ „ ์„ธ๊ณ„ ์‚ฌ์šฉ์ž๋“ค์ด ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์›น์‚ฌ์ดํŠธ๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“œ๋Š” ๋ชจ๋“  ๊ณผ์ •์„ ๋งํ•ด.

๐ŸŒŸ i18n์˜ ํ•ต์‹ฌ ๊ฐ€์น˜ 1. ์‹œ์žฅ ํ™•๋Œ€: ํ•œ๊ตญ์–ด๋งŒ ์ง€์›ํ•˜๋ฉด 5์ฒœ๋งŒ ๋ช…, ์˜์–ด๊นŒ์ง€ ์ง€์›ํ•˜๋ฉด 15์–ต ๋ช… ์ด์ƒ์˜ ์ž ์žฌ ๊ณ ๊ฐ
2. ์‚ฌ์šฉ์ž ๊ฒฝํ—˜: ๋ชจ๊ตญ์–ด๋กœ ์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•  ๋•Œ ์‹ ๋ขฐ๋„๊ฐ€ 70% ์ด์ƒ ์ฆ๊ฐ€
3. ๊ฒฝ์Ÿ๋ ฅ: ๊ธ€๋กœ๋ฒŒ ๊ธฐ์—…๋“ค์˜ ํ•„์ˆ˜ ์š”๊ฑด, ์ฐจ๋ณ„ํ™” ํฌ์ธํŠธ
4. SEO ํšจ๊ณผ: ๊ฐ ์–ธ์–ด๋ณ„ ๊ฒ€์ƒ‰ ์—”์ง„ ์ตœ์ ํ™”๋กœ ํŠธ๋ž˜ํ”ฝ ์ฆ๊ฐ€

์‹ค์ œ๋กœ ์žฌ๋Šฅ๋„ท ๊ฐ™์€ ํ”Œ๋žซํผ๋„ ๋‹ค์–‘ํ•œ ์žฌ๋Šฅ์„ ๊ฐ€์ง„ ์‚ฌ๋žŒ๋“ค์ด ๊ตญ๊ฒฝ์„ ๋„˜์–ด ๊ฑฐ๋ž˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋‹ค๊ตญ์–ด ์ง€์›์„ ๊ณ ๋ คํ•˜๊ณ  ์žˆ์–ด. ํ”„๋กœ๊ทธ๋ž˜๋ฐ, ๋””์ž์ธ, ๋ฒˆ์—ญ ๋“ฑ ๋‹ค์–‘ํ•œ ์žฌ๋Šฅ์ด ์˜ค๊ฐ€๋Š” ๊ณณ์ด๋‹ˆ๊นŒ ๋ง์ด์•ผ. ๐Ÿ’ผ

๐Ÿ—๏ธ i18n ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„ ๊ธฐ์ดˆ

1. ๊ธฐ๋ณธ ๊ฐœ๋… ์ดํ•ดํ•˜๊ธฐ

๊ตญ์ œํ™”๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์ „์— ์•Œ์•„์•ผ ํ•  ํ•ต์‹ฌ ๊ฐœ๋…๋“ค์ด ์žˆ์–ด. ์ด๊ฑธ ๋ชจ๋ฅด๊ณ  ์‹œ์ž‘ํ•˜๋ฉด ๋‚˜์ค‘์— ์ „์ฒด๋ฅผ ๋‹ค์‹œ ๋งŒ๋“ค์–ด์•ผ ํ•  ์ˆ˜๋„ ์žˆ์œผ๋‹ˆ ์ฃผ์˜! โš ๏ธ

๐Ÿ“š ํ•„์ˆ˜ ์šฉ์–ด ์ •๋ฆฌ โ€ข Locale: ์–ธ์–ด์™€ ์ง€์—ญ์„ ์กฐํ•ฉํ•œ ์ฝ”๋“œ (์˜ˆ: ko-KR, en-US, ja-JP)
โ€ข Translation Key: ๋ฒˆ์—ญ ๋ฌธ์ž์—ด์„ ์‹๋ณ„ํ•˜๋Š” ๊ณ ์œ  ํ‚ค
โ€ข Fallback Language: ๋ฒˆ์—ญ์ด ์—†์„ ๋•Œ ๋Œ€์ฒดํ•  ๊ธฐ๋ณธ ์–ธ์–ด
โ€ข RTL (Right-to-Left): ์•„๋ž์–ด, ํžˆ๋ธŒ๋ฆฌ์–ด์ฒ˜๋Ÿผ ์˜ค๋ฅธ์ชฝ์—์„œ ์™ผ์ชฝ์œผ๋กœ ์“ฐ๋Š” ์–ธ์–ด
โ€ข Pluralization: ๋‹จ์ˆ˜/๋ณต์ˆ˜ ํ˜•ํƒœ ์ฒ˜๋ฆฌ
โ€ข Interpolation: ๋ฒˆ์—ญ ๋ฌธ์ž์—ด์— ๋ณ€์ˆ˜ ์‚ฝ์ž…

2. ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ ์„ค๊ณ„

์ฒ˜์Œ๋ถ€ํ„ฐ ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ๊ตฌ์กฐ๋กœ ๋งŒ๋“œ๋Š” ๊ฒŒ ์ค‘์š”ํ•ด. ๋‚˜์ค‘์— ์–ธ์–ด ์ถ”๊ฐ€ํ•  ๋•Œ๋งˆ๋‹ค ์ฝ”๋“œ ์ „์ฒด๋ฅผ ๋’ค์ง‘๊ณ  ์‹ถ์ง€ ์•Š๋‹ค๋ฉด ๋ง์ด์•ผ. ๐Ÿ›๏ธ

project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ locales/           # ๋ฒˆ์—ญ ํŒŒ์ผ ๋””๋ ‰ํ† ๋ฆฌ
โ”‚   โ”‚   โ”œโ”€โ”€ ko/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ common.json
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ home.json
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ errors.json
โ”‚   โ”‚   โ”œโ”€โ”€ en/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ common.json
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ home.json
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ errors.json
โ”‚   โ”‚   โ””โ”€โ”€ ja/
โ”‚   โ”‚       โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ i18n/              # i18n ์„ค์ • ๋ฐ ์œ ํ‹ธ
โ”‚   โ”‚   โ”œโ”€โ”€ config.js
โ”‚   โ”‚   โ”œโ”€โ”€ detector.js    # ์–ธ์–ด ๊ฐ์ง€
โ”‚   โ”‚   โ””โ”€โ”€ formatter.js   # ๋‚ ์งœ, ์ˆซ์ž ํฌ๋งท
โ”‚   โ””โ”€โ”€ components/
โ””โ”€โ”€ public/
    โ””โ”€โ”€ locales/           # ์ •์  ๋ฒˆ์—ญ ํŒŒ์ผ (์˜ต์…˜)

์ด๋ ‡๊ฒŒ ๊ตฌ์กฐ๋ฅผ ์žก์œผ๋ฉด ๊ฐ ์–ธ์–ด๋ณ„๋กœ ํŒŒ์ผ์„ ๋ถ„๋ฆฌํ•ด์„œ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ณ , ๋ฒˆ์—ญ๊ฐ€๋“ค๋„ ์‰ฝ๊ฒŒ ์ž‘์—…ํ•  ์ˆ˜ ์žˆ์–ด. โœจ

3. ๋ฒˆ์—ญ ํŒŒ์ผ ํฌ๋งท ์„ ํƒ

JSON์ด ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ด์ง€๋งŒ, ํ”„๋กœ์ ํŠธ ํŠน์„ฑ์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ํฌ๋งท๋„ ๊ณ ๋ คํ•ด๋ณผ ์ˆ˜ ์žˆ์–ด.

๐Ÿ“„ ํฌ๋งท๋ณ„ ํŠน์ง• JSON: ๊ฐ€์žฅ ๋ณดํŽธ์ , JavaScript์™€ ํ˜ธํ™˜์„ฑ ์ข‹์Œ, ์ค‘์ฒฉ ๊ตฌ์กฐ ์ง€์›
YAML: ๊ฐ€๋…์„ฑ ์šฐ์ˆ˜, ์ฃผ์„ ๊ฐ€๋Šฅ, ๋ณต์žกํ•œ ๊ตฌ์กฐ์— ์ ํ•ฉ
PO/POT: ์ „๋ฌธ ๋ฒˆ์—ญ ๋„๊ตฌ ์ง€์›, ๋ฒˆ์—ญ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ
ICU Message Format: ๋ณต์žกํ•œ ๋ฌธ๋ฒ• ๊ทœ์น™ ์ฒ˜๋ฆฌ์— ๊ฐ•๋ ฅ

JSON ์˜ˆ์‹œ๋ฅผ ๋ณด๋ฉด ์ดํ•ด๊ฐ€ ๋น ๋ฅผ ๊ฑฐ์•ผ:

{
  "common": {
    "welcome": "ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค",
    "login": "๋กœ๊ทธ์ธ",
    "logout": "๋กœ๊ทธ์•„์›ƒ"
  },
  "home": {
    "title": "ํ™ˆํŽ˜์ด์ง€",
    "greeting": "์•ˆ๋…•ํ•˜์„ธ์š”, {{name}}๋‹˜!",
    "itemCount": "{{count}}๊ฐœ์˜ ์•„์ดํ…œ"
  },
  "errors": {
    "notFound": "ํŽ˜์ด์ง€๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค",
    "serverError": "์„œ๋ฒ„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"
  }
}

โš™๏ธ ์ฃผ์š” ํ”„๋ ˆ์ž„์›Œํฌ๋ณ„ ๊ตฌํ˜„ ๋ฐฉ๋ฒ•

1. React์—์„œ i18n ๊ตฌํ˜„ํ•˜๊ธฐ

React์—์„œ๋Š” react-i18next๊ฐ€ ์‚ฌ์‹ค์ƒ ํ‘œ์ค€์ด์•ผ. ์‚ฌ์šฉ๋ฒ•๋„ ์ง๊ด€์ ์ด๊ณ  ๊ธฐ๋Šฅ๋„ ๊ฐ•๋ ฅํ•ด์„œ ๋Œ€๋ถ€๋ถ„์˜ ํ”„๋กœ์ ํŠธ์—์„œ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด. โš›๏ธ

// i18n.js ์„ค์ • ํŒŒ์ผ
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';

import translationKO from './locales/ko/translation.json';
import translationEN from './locales/en/translation.json';

const resources = {
  ko: { translation: translationKO },
  en: { translation: translationEN }
};

i18n
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    resources,
    fallbackLng: 'ko',
    debug: false,
    interpolation: {
      escapeValue: false
    }
  });

export default i18n;

์ปดํฌ๋„ŒํŠธ์—์„œ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ์ด๋ ‡๊ฒŒ ๊ฐ„๋‹จํ•ด:

import { useTranslation } from 'react-i18next';

function Welcome() {
  const { t, i18n } = useTranslation();
  
  const changeLanguage = (lng) => {
    i18n.changeLanguage(lng);
  };
  
  return (
    <div>
      <h1>{t('common.welcome')}</h1>
      <p>{t('home.greeting', { name: '์ฒ ์ˆ˜' })}</p>
      <button onClick={() => changeLanguage('en')}>English</button>
      <button onClick={() => changeLanguage('ko')}>ํ•œ๊ตญ์–ด</button>
    </div>
  );
}
๐Ÿ’ก React i18n ํŒ 1. Suspense ํ™œ์šฉ: ๋ฒˆ์—ญ ํŒŒ์ผ ๋กœ๋”ฉ ์ค‘ fallback UI ํ‘œ์‹œ
2. Namespace ๋ถ„๋ฆฌ: ํŽ˜์ด์ง€๋ณ„๋กœ ๋ฒˆ์—ญ ํŒŒ์ผ ๋ถ„๋ฆฌํ•ด์„œ ๋ฒˆ๋“ค ํฌ๊ธฐ ์ตœ์ ํ™”
3. Trans ์ปดํฌ๋„ŒํŠธ: HTML ํƒœ๊ทธ๊ฐ€ ํฌํ•จ๋œ ๋ฒˆ์—ญ์— ์‚ฌ์šฉ
4. Context API ์—ฐ๋™: ์ „์—ญ ์–ธ์–ด ์ƒํƒœ ๊ด€๋ฆฌ

2. Vue.js์—์„œ i18n ๊ตฌํ˜„ํ•˜๊ธฐ

Vue๋Š” vue-i18n์ด ๊ณต์‹ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์•ผ. Vue 3๋ถ€ํ„ฐ๋Š” Composition API์™€๋„ ์™„๋ฒฝํ•˜๊ฒŒ ํ˜ธํ™˜๋ผ. ๐ŸŽจ

// i18n.js
import { createI18n } from 'vue-i18n';

const messages = {
  ko: {
    message: {
      hello: '์•ˆ๋…•ํ•˜์„ธ์š”',
      welcome: '{name}๋‹˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค'
    }
  },
  en: {
    message: {
      hello: 'Hello',
      welcome: 'Welcome, {name}'
    }
  }
};

const i18n = createI18n({
  locale: 'ko',
  fallbackLocale: 'en',
  messages
});

export default i18n;

// main.js
import { createApp } from 'vue';
import App from './App.vue';
import i18n from './i18n';

createApp(App).use(i18n).mount('#app');

์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ์ด๋ ‡๊ฒŒ ์‚ฌ์šฉํ•ด:

<template>
  <div>
    <h1>{{ $t('message.hello') }}</h1>
    <p>{{ $t('message.welcome', { name: userName }) }}</p>
    <select v-model="$i18n.locale">
      <option value="ko">ํ•œ๊ตญ์–ด</option>
      <option value="en">English</option>
    </select>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';

const { t, locale } = useI18n();
const userName = ref('์˜ํฌ');
</script>

3. Next.js์—์„œ i18n ๊ตฌํ˜„ํ•˜๊ธฐ

Next.js๋Š” ํ”„๋ ˆ์ž„์›Œํฌ ์ž์ฒด์— i18n ๋ผ์šฐํŒ… ๊ธฐ๋Šฅ์ด ๋‚ด์žฅ๋˜์–ด ์žˆ์–ด์„œ SEO์— ํŠนํžˆ ์œ ๋ฆฌํ•ด. ๐Ÿš€

// next.config.js
module.exports = {
  i18n: {
    locales: ['ko', 'en', 'ja'],
    defaultLocale: 'ko',
    localeDetection: true
  }
};

// pages/index.js
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useTranslation } from 'next-i18next';

export default function Home() {
  const { t } = useTranslation('common');
  
  return (
    <div>
      <h1>{t('welcome')}</h1>
    </div>
  );
}

export async function getStaticProps({ locale }) {
  return {
    props: {
      ...(await serverSideTranslations(locale, ['common']))
    }
  };
}
โš ๏ธ Next.js i18n ์ฃผ์˜์‚ฌํ•ญ 1. ๋ผ์šฐํŒ… ์ „๋žต: ์„œ๋ธŒํŒจ์Šค(/ko/, /en/) vs ๋„๋ฉ”์ธ(ko.site.com) ์„ ํƒ ํ•„์š”
2. SSR/SSG ๊ณ ๋ ค: getStaticProps๋‚˜ getServerSideProps์—์„œ ๋ฒˆ์—ญ ๋กœ๋“œ
3. ๋™์  ๋ผ์šฐํŒ…: [locale] ํด๋” ๊ตฌ์กฐ๋กœ ๊ด€๋ฆฌ
4. ๋ฏธ๋“ค์›จ์–ด ํ™œ์šฉ: Next.js 12+ ์—์„œ ์–ธ์–ด ๊ฐ์ง€ ๋ฐ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ

4. Angular์—์„œ i18n ๊ตฌํ˜„ํ•˜๊ธฐ

Angular๋Š” ๊ณต์‹ i18n ์†”๋ฃจ์…˜์ด ์žˆ๊ณ , ๋นŒ๋“œ ํƒ€์ž„์— ๋ฒˆ์—ญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์ด ํŠน์ง•์ด์•ผ. ๐Ÿ…ฐ๏ธ

// angular.json ์„ค์ •
{
  "projects": {
    "myapp": {
      "i18n": {
        "sourceLocale": "ko",
        "locales": {
          "en": "src/locale/messages.en.xlf",
          "ja": "src/locale/messages.ja.xlf"
        }
      }
    }
  }
}

// ์ปดํฌ๋„ŒํŠธ์—์„œ ์‚ฌ์šฉ
<h1 i18n="@@welcomeMessage">ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค</h1>
<p i18n>์•ˆ๋…•ํ•˜์„ธ์š”, {{userName}}๋‹˜!</p>

// ์ถ”์ถœ ๋ช…๋ น์–ด
ng extract-i18n --output-path src/locale

// ๋นŒ๋“œ
ng build --localize

๐ŸŽจ UI/UX ๊ตญ์ œํ™” ๊ณ ๋ ค์‚ฌํ•ญ

1. ํ…์ŠคํŠธ ๊ธธ์ด ๋ณ€ํ™” ๋Œ€์‘

๊ฐ™์€ ๋‚ด์šฉ์ด๋ผ๋„ ์–ธ์–ด๋งˆ๋‹ค ๊ธธ์ด๊ฐ€ ์™„์ „ํžˆ ๋‹ฌ๋ผ์ ธ. ๋…์ผ์–ด๋Š” ์˜์–ด๋ณด๋‹ค ํ‰๊ท  30% ๋” ๊ธธ๊ณ , ํ•œ๊ตญ์–ด๋Š” ์ƒํ™ฉ์— ๋”ฐ๋ผ ์งง์„ ์ˆ˜๋„ ๊ธธ ์ˆ˜๋„ ์žˆ์–ด. ๐Ÿ“

๐Ÿ”ค ์–ธ์–ด๋ณ„ ํ…์ŠคํŠธ ๊ธธ์ด ๋น„๊ต ์˜์–ด "Save"
โ€ข ๋…์ผ์–ด: "Speichern" (์•ฝ 2๋ฐฐ)
โ€ข ํ”„๋ž‘์Šค์–ด: "Enregistrer" (์•ฝ 2.5๋ฐฐ)
โ€ข ํ•œ๊ตญ์–ด: "์ €์žฅ" (๋น„์Šท)
โ€ข ์ผ๋ณธ์–ด: "ไฟๅญ˜" (๋น„์Šท)

๋””์ž์ธ ํŒ: ๋ฒ„ํŠผ๊ณผ ๋ ˆ์ด๋ธ”์— ์ตœ์†Œ 30% ์—ฌ์œ  ๊ณต๊ฐ„ ํ™•๋ณด
/* CSS๋กœ ํ…์ŠคํŠธ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ์ฒ˜๋ฆฌ */
.button {
  min-width: 120px;
  padding: 10px 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ์–ธ์–ด๋ณ„ ์กฐ๊ฑด๋ถ€ ์Šคํƒ€์ผ */
[lang="de"] .button {
  min-width: 150px;
}

[lang="ko"] .button,
[lang="ja"] .button {
  min-width: 100px;
}

2. RTL (Right-to-Left) ์–ธ์–ด ์ง€์›

์•„๋ž์–ด, ํžˆ๋ธŒ๋ฆฌ์–ด, ํŽ˜๋ฅด์‹œ์•„์–ด๋Š” ์˜ค๋ฅธ์ชฝ์—์„œ ์™ผ์ชฝ์œผ๋กœ ์ฝ์–ด. ๋‹จ์ˆœํžˆ ํ…์ŠคํŠธ๋งŒ ๋’ค์ง‘๋Š” ๊ฒŒ ์•„๋‹ˆ๋ผ ์ „์ฒด ๋ ˆ์ด์•„์›ƒ์ด ๋ฏธ๋Ÿฌ๋ง๋˜์–ด์•ผ ํ•ด. ๐Ÿชž

/* RTL ์ž๋™ ๋Œ€์‘ CSS */
.container {
  margin-inline-start: 20px;  /* margin-left ๋Œ€์‹  */
  padding-inline-end: 15px;   /* padding-right ๋Œ€์‹  */
}

/* RTL ๊ฐ์ง€ ๋ฐ ์ ์šฉ */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

[dir="rtl"] .icon {
  transform: scaleX(-1);  /* ์•„์ด์ฝ˜ ์ขŒ์šฐ ๋ฐ˜์ „ */
}

/* JavaScript๋กœ dir ์†์„ฑ ์„ค์ • */
document.documentElement.dir = locale === 'ar' ? 'rtl' : 'ltr';
๐Ÿ’ก RTL ๋””์ž์ธ ์ฒดํฌ๋ฆฌ์ŠคํŠธ
  • โœ“ ๋ ˆ์ด์•„์›ƒ: ์‚ฌ์ด๋“œ๋ฐ”, ๋„ค๋น„๊ฒŒ์ด์…˜ ์œ„์น˜ ๋ฐ˜์ „
  • โœ“ ์•„์ด์ฝ˜: ๋ฐฉํ–ฅ์„ฑ ์žˆ๋Š” ์•„์ด์ฝ˜(ํ™”์‚ดํ‘œ ๋“ฑ) ๋ฐ˜์ „
  • โœ“ ํผ: ๋ผ๋ฒจ๊ณผ ์ž…๋ ฅ ํ•„๋“œ ์œ„์น˜ ์กฐ์ •
  • โœ“ ์• ๋‹ˆ๋ฉ”์ด์…˜: ์Šฌ๋ผ์ด๋“œ ๋ฐฉํ–ฅ ๋ฐ˜์ „
  • โœ“ ํ…์ŠคํŠธ ์ •๋ ฌ: text-align: start/end ์‚ฌ์šฉ

3. ๋‚ ์งœ์™€ ์‹œ๊ฐ„ ํ˜•์‹

๋‚ ์งœ ํ‘œ๊ธฐ๋Š” ๋‚˜๋ผ๋งˆ๋‹ค ์™„์ „ํžˆ ๋‹ฌ๋ผ. ๋ฏธ๊ตญ์€ MM/DD/YYYY, ํ•œ๊ตญ์€ YYYY.MM.DD, ์œ ๋Ÿฝ์€ DD/MM/YYYY๋ฅผ ์จ. ๐Ÿ“…

// JavaScript Intl API ํ™œ์šฉ
const date = new Date('2024-01-15');

// ํ•œ๊ตญ์–ด
const koFormat = new Intl.DateTimeFormat('ko-KR', {
  year: 'numeric',
  month: 'long',
  day: 'numeric'
}).format(date);
// ๊ฒฐ๊ณผ: "2024๋…„ 1์›” 15์ผ"

// ์˜์–ด (๋ฏธ๊ตญ)
const enUSFormat = new Intl.DateTimeFormat('en-US', {
  year: 'numeric',
  month: 'long',
  day: 'numeric'
}).format(date);
// ๊ฒฐ๊ณผ: "January 15, 2024"

// ์˜์–ด (์˜๊ตญ)
const enGBFormat = new Intl.DateTimeFormat('en-GB', {
  year: 'numeric',
  month: 'long',
  day: 'numeric'
}).format(date);
// ๊ฒฐ๊ณผ: "15 January 2024"

// ์ƒ๋Œ€ ์‹œ๊ฐ„ ํ‘œ์‹œ
const rtf = new Intl.RelativeTimeFormat('ko', { numeric: 'auto' });
rtf.format(-1, 'day');  // "์–ด์ œ"
rtf.format(2, 'hour');  // "2์‹œ๊ฐ„ ํ›„"

4. ์ˆซ์ž์™€ ํ†ตํ™” ํ˜•์‹

์ˆซ์ž ํ‘œ๊ธฐ๋„ ์ฒœ์ฐจ๋งŒ๋ณ„์ด์•ผ. ์ฒœ ๋‹จ์œ„ ๊ตฌ๋ถ„์ž๊ฐ€ ์‰ผํ‘œ์ธ ๊ณณ๋„ ์žˆ๊ณ  ์ ์ธ ๊ณณ๋„ ์žˆ์–ด. ๐Ÿ’ฐ

const number = 1234567.89;

// ํ•œ๊ตญ์–ด
new Intl.NumberFormat('ko-KR').format(number);
// "1,234,567.89"

// ๋…์ผ์–ด
new Intl.NumberFormat('de-DE').format(number);
// "1.234.567,89"

// ํ†ตํ™” ํ˜•์‹
new Intl.NumberFormat('ko-KR', {
  style: 'currency',
  currency: 'KRW'
}).format(50000);
// "โ‚ฉ50,000"

new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD'
}).format(50000);
// "$50,000.00"

new Intl.NumberFormat('ja-JP', {
  style: 'currency',
  currency: 'JPY'
}).format(50000);
// "ยฅ50,000"

5. ํฐํŠธ์™€ ํƒ€์ดํฌ๊ทธ๋ž˜ํ”ผ

์–ธ์–ด๋งˆ๋‹ค ํ•„์š”ํ•œ ํฐํŠธ๊ฐ€ ๋‹ค๋ฅด๊ณ , ๊ฐ€๋…์„ฑ์„ ์œ„ํ•œ ์ตœ์  ํฌ๊ธฐ๋„ ๋‹ฌ๋ผ. ํŠนํžˆ CJK(์ค‘๊ตญ์–ด, ์ผ๋ณธ์–ด, ํ•œ๊ตญ์–ด)๋Š” ๊ธ€์ž ์ˆ˜๊ฐ€ ๋งŽ์•„์„œ ์›นํฐํŠธ ์šฉ๋Ÿ‰์ด ์ปค์งˆ ์ˆ˜ ์žˆ์–ด. ๐Ÿ”ค

/* ์–ธ์–ด๋ณ„ ํฐํŠธ ์Šคํƒ */
body {
  font-family: 
    -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto,
    "Noto Sans KR",        /* ํ•œ๊ตญ์–ด */
    "Noto Sans JP",        /* ์ผ๋ณธ์–ด */
    "Noto Sans SC",        /* ์ค‘๊ตญ์–ด ๊ฐ„์ฒด */
    sans-serif;
}

/* ์–ธ์–ด๋ณ„ ํฐํŠธ ํฌ๊ธฐ ์กฐ์ • */
[lang="ko"] {
  font-size: 16px;
  line-height: 1.6;
}

[lang="ja"] {
  font-size: 15px;
  line-height: 1.8;
}

[lang="th"] {  /* ํƒœ๊ตญ์–ด๋Š” ์ค„๊ฐ„๊ฒฉ ๋” ํ•„์š” */
  line-height: 2.0;
}

/* ์›นํฐํŠธ ์„œ๋ธŒ์…‹ ๋กœ๋”ฉ */
@font-face {
  font-family: 'Noto Sans KR';
  src: url('/fonts/NotoSansKR-subset.woff2') format('woff2');
  unicode-range: U+AC00-D7A3;  /* ํ•œ๊ธ€ ๋ฒ”์œ„๋งŒ */
  font-display: swap;
}

๐Ÿ”ง ๊ณ ๊ธ‰ i18n ๊ธฐ๋Šฅ ๊ตฌํ˜„

1. ๋ณต์ˆ˜ํ˜•(Pluralization) ์ฒ˜๋ฆฌ

"1๊ฐœ์˜ ์•„์ดํ…œ"๊ณผ "2๊ฐœ์˜ ์•„์ดํ…œ"์ฒ˜๋Ÿผ ์ˆซ์ž์— ๋”ฐ๋ผ ํ‘œํ˜„์ด ๋‹ฌ๋ผ์ง€๋Š” ๊ฑธ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•ด. ์–ธ์–ด๋งˆ๋‹ค ๋ณต์ˆ˜ํ˜• ๊ทœ์น™์ด ์™„์ „ํžˆ ๋‹ค๋ฅด๋‹ค๋Š” ๊ฒŒ ํ•จ์ •์ด์•ผ. ๐Ÿ”ข

๐ŸŒ ์–ธ์–ด๋ณ„ ๋ณต์ˆ˜ํ˜• ๊ทœ์น™ ์˜์–ด: 2๊ฐ€์ง€ ํ˜•ํƒœ (1 / 2+)
ํ•œ๊ตญ์–ด/์ผ๋ณธ์–ด: 1๊ฐ€์ง€ ํ˜•ํƒœ (์ˆซ์ž๋งŒ ๋ฐ”๋€œ)
๋Ÿฌ์‹œ์•„์–ด: 3๊ฐ€์ง€ ํ˜•ํƒœ (1, 2-4, 5+)
์•„๋ž์–ด: 6๊ฐ€์ง€ ํ˜•ํƒœ (0, 1, 2, 3-10, 11-99, 100+)
ํด๋ž€๋“œ์–ด: 4๊ฐ€์ง€ ํ˜•ํƒœ
// i18next ๋ณต์ˆ˜ํ˜• ์˜ˆ์‹œ
{
  "en": {
    "item": "{{count}} item",
    "item_plural": "{{count}} items"
  },
  "ko": {
    "item": "{{count}}๊ฐœ์˜ ์•„์ดํ…œ"
  },
  "ru": {
    "item_one": "{{count}} ะฟั€ะตะดะผะตั‚",
    "item_few": "{{count}} ะฟั€ะตะดะผะตั‚ะฐ",
    "item_many": "{{count}} ะฟั€ะตะดะผะตั‚ะพะฒ"
  }
}

// ์‚ฌ์šฉ
t('item', { count: 1 });  // "1 item" / "1๊ฐœ์˜ ์•„์ดํ…œ"
t('item', { count: 5 });  // "5 items" / "5๊ฐœ์˜ ์•„์ดํ…œ"

// ICU Message Format ์‚ฌ์šฉ
{
  "items": "{count, plural, =0 {no items} one {# item} other {# items}}"
}

2. ์ปจํ…์ŠคํŠธ๋ณ„ ๋ฒˆ์—ญ

๊ฐ™์€ ๋‹จ์–ด๋ผ๋„ ๋ฌธ๋งฅ์— ๋”ฐ๋ผ ๋ฒˆ์—ญ์ด ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์–ด. ์˜ˆ๋ฅผ ๋“ค์–ด "Close"๋Š” "๋‹ซ๊ธฐ"์ผ ์ˆ˜๋„ ์žˆ๊ณ  "๊ฐ€๊นŒ์šด"์ผ ์ˆ˜๋„ ์žˆ์ง€. ๐ŸŽญ

{
  "close_button": "๋‹ซ๊ธฐ",
  "close_distance": "๊ฐ€๊นŒ์šด",
  "close_relationship": "์นœ๋ฐ€ํ•œ",
  
  "bank_financial": "์€ํ–‰",
  "bank_river": "๊ฐ•๋‘‘",
  
  "date_calendar": "๋‚ ์งœ",
  "date_romantic": "๋ฐ์ดํŠธ"
}

// ์ปจํ…์ŠคํŠธ ๋ช…์‹œ์  ์‚ฌ์šฉ
t('close', { context: 'button' });     // "๋‹ซ๊ธฐ"
t('close', { context: 'distance' });   // "๊ฐ€๊นŒ์šด"

3. ๋™์  ์ฝ˜ํ…์ธ  ๋ฒˆ์—ญ

์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ์ฝ˜ํ…์ธ ๋‚˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ๊ฐ€์ ธ์˜จ ๋‚ด์šฉ๋„ ๋ฒˆ์—ญ์ด ํ•„์š”ํ•  ๋•Œ๊ฐ€ ์žˆ์–ด. ์ด๊ฑด ์ข€ ๋” ๋ณต์žกํ•œ ์ „๋žต์ด ํ•„์š”ํ•ด. ๐Ÿ”„

// ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์Šคํ‚ค๋งˆ ์˜ˆ์‹œ
CREATE TABLE products (
  id INT PRIMARY KEY,
  name_ko VARCHAR(255),
  name_en VARCHAR(255),
  name_ja VARCHAR(255),
  description_ko TEXT,
  description_en TEXT,
  description_ja TEXT
);

// ๋˜๋Š” JSON ์ปฌ๋Ÿผ ์‚ฌ์šฉ
CREATE TABLE products (
  id INT PRIMARY KEY,
  translations JSON
);

// translations ์˜ˆ์‹œ
{
  "ko": {
    "name": "์ƒํ’ˆ๋ช…",
    "description": "์ƒํ’ˆ ์„ค๋ช…"
  },
  "en": {
    "name": "Product Name",
    "description": "Product Description"
  }
}

// API ์‘๋‹ต ๊ตฌ์กฐ
{
  "id": 1,
  "name": {
    "ko": "๋…ธํŠธ๋ถ",
    "en": "Laptop",
    "ja": "ใƒŽใƒผใƒˆใƒ‘ใ‚ฝใ‚ณใƒณ"
  },
  "price": 1500000
}

// ํ”„๋ก ํŠธ์—”๋“œ์—์„œ ์‚ฌ์šฉ
const product = await fetchProduct(id);
const localizedName = product.name[currentLocale];
๐Ÿ’ก ๋™์  ์ฝ˜ํ…์ธ  ๋ฒˆ์—ญ ์ „๋žต 1. ๋‹ค์ค‘ ์ปฌ๋Ÿผ: ๊ฐ„๋‹จํ•˜์ง€๋งŒ ์ปฌ๋Ÿผ ์ˆ˜๊ฐ€ ๋งŽ์•„์ง
2. JSON ํ•„๋“œ: ์œ ์—ฐํ•˜์ง€๋งŒ ์ฟผ๋ฆฌ๊ฐ€ ๋ณต์žกํ•ด์งˆ ์ˆ˜ ์žˆ์Œ
3. ๋ณ„๋„ ํ…Œ์ด๋ธ”: ์ •๊ทœํ™”๋˜์ง€๋งŒ JOIN ํ•„์š”
4. ๋ฒˆ์—ญ API: Google Translate API ๋“ฑ ํ™œ์šฉ (๋น„์šฉ ๋ฐœ์ƒ)

4. ์–ธ์–ด ๊ฐ์ง€ ๋ฐ ์ž๋™ ์ „ํ™˜

์‚ฌ์šฉ์ž์˜ ์–ธ์–ด๋ฅผ ์ž๋™์œผ๋กœ ๊ฐ์ง€ํ•ด์„œ ์ ์ ˆํ•œ ์–ธ์–ด๋กœ ๋ณด์—ฌ์ฃผ๋Š” ๊ฒŒ ์ข‹์€ UX์•ผ. ํ•˜์ง€๋งŒ ๊ฐ•์ œํ•˜๋ฉด ์•ˆ ๋˜๊ณ  ์„ ํƒ๊ถŒ์„ ์ค˜์•ผ ํ•ด. ๐ŸŽฏ

// ์–ธ์–ด ๊ฐ์ง€ ์šฐ์„ ์ˆœ์œ„
function detectLanguage() {
  // 1. URL ํŒŒ๋ผ๋ฏธํ„ฐ ํ™•์ธ
  const urlParams = new URLSearchParams(window.location.search);
  const urlLang = urlParams.get('lang');
  if (urlLang && supportedLanguages.includes(urlLang)) {
    return urlLang;
  }
  
  // 2. ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ํ™•์ธ (์‚ฌ์šฉ์ž๊ฐ€ ์ด์ „์— ์„ ํƒํ•œ ์–ธ์–ด)
  const savedLang = localStorage.getItem('preferredLanguage');
  if (savedLang && supportedLanguages.includes(savedLang)) {
    return savedLang;
  }
  
  // 3. ๋ธŒ๋ผ์šฐ์ € ์–ธ์–ด ์„ค์ • ํ™•์ธ
  const browserLang = navigator.language.split('-')[0];
  if (supportedLanguages.includes(browserLang)) {
    return browserLang;
  }
  
  // 4. IP ๊ธฐ๋ฐ˜ ์ง€์—ญ ๊ฐ์ง€ (์„ ํƒ์ )
  // const geoLang = await detectLanguageByIP();
  
  // 5. ๊ธฐ๋ณธ ์–ธ์–ด ๋ฐ˜ํ™˜
  return 'ko';
}

// ์–ธ์–ด ๋ณ€๊ฒฝ ํ•จ์ˆ˜
function changeLanguage(newLang) {
  // ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€์— ์ €์žฅ
  localStorage.setItem('preferredLanguage', newLang);
  
  // i18n ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์–ธ์–ด ๋ณ€๊ฒฝ
  i18n.changeLanguage(newLang);
  
  // URL ์—…๋ฐ์ดํŠธ (์„ ํƒ์ )
  const url = new URL(window.location);
  url.searchParams.set('lang', newLang);
  window.history.pushState({}, '', url);
  
  // HTML lang ์†์„ฑ ์—…๋ฐ์ดํŠธ
  document.documentElement.lang = newLang;
  
  // RTL ์–ธ์–ด ์ฒ˜๋ฆฌ
  document.documentElement.dir = rtlLanguages.includes(newLang) ? 'rtl' : 'ltr';
}

5. ๋ฒˆ์—ญ ๋ˆ„๋ฝ ์ฒ˜๋ฆฌ

๋ชจ๋“  ํ…์ŠคํŠธ๊ฐ€ ์™„๋ฒฝํ•˜๊ฒŒ ๋ฒˆ์—ญ๋˜์–ด ์žˆ์„ ์ˆ˜๋Š” ์—†์–ด. ๋ฒˆ์—ญ์ด ์—†์„ ๋•Œ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ• ์ง€ ์ „๋žต์ด ํ•„์š”ํ•ด. ๐Ÿšจ

// i18next ์„ค์ •
i18n.init({
  fallbackLng: 'ko',  // ๊ธฐ๋ณธ ์–ธ์–ด
  
  // ๋ฒˆ์—ญ ๋ˆ„๋ฝ ์‹œ ์ฒ˜๋ฆฌ
  saveMissing: true,  // ๋ˆ„๋ฝ๋œ ํ‚ค ์ €์žฅ
  missingKeyHandler: (lngs, ns, key, fallbackValue) => {
    // ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ๋กœ๊น…
    if (process.env.NODE_ENV === 'development') {
      console.warn(`Missing translation: ${key} for ${lngs}`);
    }
    
    // ์„œ๋ฒ„์— ๋ˆ„๋ฝ ํ‚ค ์ „์†ก (์„ ํƒ์ )
    reportMissingTranslation(lngs, key);
  },
  
  // ํ‚ค๋ฅผ ๊ทธ๋Œ€๋กœ ํ‘œ์‹œํ•˜์ง€ ์•Š๊ณ  ์ฒ˜๋ฆฌ
  parseMissingKeyHandler: (key) => {
    // "user.profile.name" -> "Name"
    return key.split('.').pop().replace(/_/g, ' ');
  }
});

// ๋ฒˆ์—ญ ์ƒํƒœ ํ‘œ์‹œ
function TranslationStatus({ translationKey }) {
  const { t, i18n } = useTranslation();
  const hasTranslation = i18n.exists(translationKey);
  
  return (
    <div>
      {t(translationKey)}
      {!hasTranslation && (
        <span className="translation-missing-badge">
          ๐Ÿ”„ ๋ฒˆ์—ญ ์ค€๋น„์ค‘
        </span>
      )}
    </div>
  );
}

๐Ÿš€ ์„ฑ๋Šฅ ์ตœ์ ํ™” ์ „๋žต

1. ๋ฒˆ์—ญ ํŒŒ์ผ ๋ถ„ํ•  ๋กœ๋”ฉ

๋ชจ๋“  ๋ฒˆ์—ญ์„ ํ•œ ๋ฒˆ์— ๋กœ๋“œํ•˜๋ฉด ์ดˆ๊ธฐ ๋กœ๋”ฉ์ด ๋А๋ ค์ ธ. ํ•„์š”ํ•œ ๊ฒƒ๋งŒ ๋กœ๋“œํ•˜๋Š” ๊ฒŒ ํ•ต์‹ฌ์ด์•ผ. โšก

// ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ณ„ ๋ถ„ํ• 
const resources = {
  ko: {
    common: () => import('./locales/ko/common.json'),
    home: () => import('./locales/ko/home.json'),
    product: () => import('./locales/ko/product.json')
  }
};

// React์—์„œ ๋™์  ๋กœ๋”ฉ
function ProductPage() {
  const { t, ready } = useTranslation('product', { 
    useSuspense: false 
  });
  
  if (!ready) return <LoadingSpinner />;
  
  return <div>{t('title')}</div>;
}

// Next.js์—์„œ ํŽ˜์ด์ง€๋ณ„ ๋กœ๋”ฉ
export async function getStaticProps({ locale }) {
  return {
    props: {
      ...(await serverSideTranslations(locale, [
        'common',
        'product'  // ์ด ํŽ˜์ด์ง€์— ํ•„์š”ํ•œ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋งŒ
      ]))
    }
  };
}

2. ๋ฒˆ์—ญ ์บ์‹ฑ ์ „๋žต

๋ฒˆ์—ญ ํŒŒ์ผ์„ ํšจ๊ณผ์ ์œผ๋กœ ์บ์‹ฑํ•˜๋ฉด ์žฌ๋ฐฉ๋ฌธ ์‹œ ๋กœ๋”ฉ ์†๋„๊ฐ€ ์—„์ฒญ ๋นจ๋ผ์ ธ. ๐Ÿ’พ

// Service Worker๋กœ ๋ฒˆ์—ญ ํŒŒ์ผ ์บ์‹ฑ
self.addEventListener('install', (event) => {
  event.waitUntil(
    caches.open('i18n-v1').then((cache) => {
      return cache.addAll([
        '/locales/ko/common.json',
        '/locales/en/common.json'
      ]);
    })
  );
});

// HTTP ์บ์‹œ ํ—ค๋” ์„ค์ • (์„œ๋ฒ„)
app.get('/locales/:lang/:namespace.json', (req, res) => {
  res.set({
    'Cache-Control': 'public, max-age=31536000',  // 1๋…„
    'ETag': generateETag(translationFile)
  });
  res.json(translations);
});

// ๋ฒ„์ „ ๊ด€๋ฆฌ๋กœ ์บ์‹œ ๋ฌดํšจํ™”
const translationUrl = `/locales/ko/common.json?v=${VERSION}`;

// IndexedDB์— ๋ฒˆ์—ญ ์ €์žฅ
async function cacheTranslations(locale, namespace, data) {
  const db = await openDB('i18n-cache', 1);
  await db.put('translations', {
    key: `${locale}-${namespace}`,
    data,
    timestamp: Date.now()
  });
}

3. ๋ฒˆ๋“ค ํฌ๊ธฐ ์ตœ์ ํ™”

ํŠนํžˆ CJK ์–ธ์–ด๋Š” ํฐํŠธ์™€ ๋ฒˆ์—ญ ํŒŒ์ผ์ด ์ปค์„œ ์ตœ์ ํ™”๊ฐ€ ์ค‘์š”ํ•ด. ๐Ÿ“ฆ

๐Ÿ“Š ๋ฒˆ๋“ค ํฌ๊ธฐ ์ตœ์ ํ™” ์ฒดํฌ๋ฆฌ์ŠคํŠธ
  • โœ“ Tree Shaking: ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๋ฒˆ์—ญ ์ œ๊ฑฐ
  • โœ“ ์••์ถ•: Gzip/Brotli ์••์ถ• ์ ์šฉ
  • โœ“ ํฐํŠธ ์„œ๋ธŒ์…‹: ํ•„์š”ํ•œ ๊ธ€์ž๋งŒ ํฌํ•จ
  • โœ“ CDN ํ™œ์šฉ: ์ง€์—ญ๋ณ„ ์—ฃ์ง€ ์„œ๋ฒ„์—์„œ ์ œ๊ณต
  • โœ“ ์ง€์—ฐ ๋กœ๋”ฉ: ์ดˆ๊ธฐ ํ™”๋ฉด์— ๋ถˆํ•„์š”ํ•œ ๋ฒˆ์—ญ ์ง€์—ฐ
// Webpack ์„ค์ •์œผ๋กœ ๋ฒˆ์—ญ ํŒŒ์ผ ์ตœ์ ํ™”
module.exports = {
  optimization: {
    splitChunks: {
      cacheGroups: {
        i18n: {
          test: /[\\/]locales[\\/]/,
          name: 'i18n',
          chunks: 'all'
        }
      }
    }
  }
};

// ํฐํŠธ ์„œ๋ธŒ์…‹ ์ƒ์„ฑ (Python ์˜ˆ์‹œ)
from fontTools import subset

options = subset.Options()
options.text = "๊ฐ€๋‚˜๋‹ค๋ผ๋งˆ๋ฐ”์‚ฌ..."  # ํ•„์š”ํ•œ ๊ธ€์ž๋งŒ
subsetter = subset.Subsetter(options)
font = TTFont('NotoSansKR-Regular.ttf')
subsetter.subset(font)
font.save('NotoSansKR-Subset.woff2')

๐Ÿ› ๏ธ ๊ฐœ๋ฐœ ์›Œํฌํ”Œ๋กœ์šฐ ๋ฐ ๋„๊ตฌ

1. ๋ฒˆ์—ญ ๊ด€๋ฆฌ ํ”Œ๋žซํผ

๋ฒˆ์—ญ๊ฐ€์™€ ๊ฐœ๋ฐœ์ž๊ฐ€ ํ˜‘์—…ํ•˜๋ ค๋ฉด ์ „๋ฌธ ๋„๊ตฌ๊ฐ€ ํ•„์š”ํ•ด. ์ˆ˜๋™์œผ๋กœ JSON ํŒŒ์ผ ์ฃผ๊ณ ๋ฐ›์œผ๋ฉด ์‹ค์ˆ˜๋„ ๋งŽ๊ณ  ๋น„ํšจ์œจ์ ์ด๊ฑฐ๋“ . ๐Ÿค

๐ŸŒŸ ์ธ๊ธฐ ๋ฒˆ์—ญ ๊ด€๋ฆฌ ๋„๊ตฌ Crowdin: ๊ฐ€์žฅ ์ธ๊ธฐ ์žˆ๋Š” ํ”Œ๋žซํผ, GitHub ์—ฐ๋™ ์šฐ์ˆ˜
Lokalise: ๊ฐœ๋ฐœ์ž ์นœํ™”์ , API ๊ฐ•๋ ฅ
Phrase: ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ๊ธ‰, ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ ๋งŽ์Œ
POEditor: ๊ฐ€์„ฑ๋น„ ์ข‹์Œ, ์ค‘์†Œ๊ทœ๋ชจ ํ”„๋กœ์ ํŠธ ์ ํ•ฉ
Weblate: ์˜คํ”ˆ์†Œ์Šค, ์ž์ฒด ํ˜ธ์ŠคํŒ… ๊ฐ€๋Šฅ
// Crowdin CLI ์‚ฌ์šฉ ์˜ˆ์‹œ
# ์„ค์ • ํŒŒ์ผ (crowdin.yml)
project_id: "123456"
api_token: "your-token"
base_path: "."

files:
  - source: /src/locales/en/**/*.json
    translation: /src/locales/%two_letters_code%/**/%original_file_name%

# ์†Œ์Šค ํŒŒ์ผ ์—…๋กœ๋“œ
crowdin upload sources

# ๋ฒˆ์—ญ ๋‹ค์šด๋กœ๋“œ
crowdin download

# GitHub Actions ์ž๋™ํ™”
name: Crowdin Sync
on:
  schedule:
    - cron: '0 0 * * *'  # ๋งค์ผ ์ž์ •
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: crowdin/github-action@v1
        with:
          upload_sources: true
          download_translations: true

2. ๋ฒˆ์—ญ ํ‚ค ๊ด€๋ฆฌ ์ „๋žต

๋ฒˆ์—ญ ํ‚ค๋ฅผ ์–ด๋–ป๊ฒŒ ๊ตฌ์กฐํ™”ํ•˜๋А๋ƒ๊ฐ€ ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ๊ฒฐ์ •ํ•ด. ์ผ๊ด€๋œ ๋„ค์ด๋ฐ ๊ทœ์น™์ด ์ค‘์š”ํ•ด. ๐Ÿ—‚๏ธ

// ์ข‹์€ ํ‚ค ๊ตฌ์กฐ ์˜ˆ์‹œ
{
  "common": {
    "button": {
      "save": "์ €์žฅ",
      "cancel": "์ทจ์†Œ",
      "delete": "์‚ญ์ œ",
      "confirm": "ํ™•์ธ"
    },
    "message": {
      "success": "์„ฑ๊ณต์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค",
      "error": "์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"
    }
  },
  "user": {
    "profile": {
      "title": "ํ”„๋กœํ•„",
      "edit": "ํ”„๋กœํ•„ ์ˆ˜์ •",
      "field": {
        "name": "์ด๋ฆ„",
        "email": "์ด๋ฉ”์ผ",
        "phone": "์ „ํ™”๋ฒˆํ˜ธ"
      }
    }
  }
}

// ๋„ค์ด๋ฐ ๊ทœ์น™
// [๋ชจ๋“ˆ].[๊ธฐ๋Šฅ].[์š”์†Œํƒ€์ž…].[๊ตฌ์ฒด์ ์„ค๋ช…]
// ์˜ˆ: user.profile.button.save
//     product.list.message.empty
//     checkout.payment.label.cardNumber

// ๋‚˜์œ ์˜ˆ์‹œ (ํ”ผํ•ด์•ผ ํ•  ๊ฒƒ๋“ค)
{
  "text1": "์ €์žฅ",           // ์˜๋ฏธ ์—†๋Š” ์ด๋ฆ„
  "saveButton": "์ €์žฅ",      // ์นด๋ฉœ์ผ€์ด์Šค ํ˜ผ์šฉ
  "user_name": "์ด๋ฆ„",       // ์Šค๋„ค์ดํฌ์ผ€์ด์Šค ํ˜ผ์šฉ
  "ํ”„๋กœํ•„": "Profile"        // ํ•œ๊ธ€ ํ‚ค ์‚ฌ์šฉ
}

3. ๋ฒˆ์—ญ ํ’ˆ์งˆ ๊ฒ€์ฆ

๋ฒˆ์—ญ์ด ์ œ๋Œ€๋กœ ๋˜์—ˆ๋Š”์ง€, ๋น ์ง„ ๊ฑด ์—†๋Š”์ง€ ์ž๋™์œผ๋กœ ์ฒดํฌํ•˜๋Š” ๊ฒŒ ์ข‹์•„. โœ…

// ๋ฒˆ์—ญ ์™„์„ฑ๋„ ์ฒดํฌ ์Šคํฌ๋ฆฝํŠธ
const fs = require('fs');
const path = require('path');

function checkTranslationCompleteness(baseLocale, targetLocale) {
  const basePath = `./locales/${baseLocale}`;
  const targetPath = `./locales/${targetLocale}`;
  
  const baseKeys = getAllKeys(basePath);
  const targetKeys = getAllKeys(targetPath);
  
  const missing = baseKeys.filter(key => !targetKeys.includes(key));
  const extra = targetKeys.filter(key => !baseKeys.includes(key));
  
  console.log(`Missing in ${targetLocale}:`, missing);
  console.log(`Extra in ${targetLocale}:`, extra);
  
  const completeness = ((targetKeys.length / baseKeys.length) * 100).toFixed(2);
  console.log(`Completeness: ${completeness}%`);
  
  return missing.length === 0;
}

// ๋ณ€์ˆ˜ ๊ฒ€์ฆ
function validateInterpolation(translations) {
  const errors = [];
  
  Object.entries(translations).forEach(([key, value]) => {
    // {{variable}} ํ˜•์‹ ์ฐพ๊ธฐ
    const variables = value.match(/\{\{(\w+)\}\}/g) || [];
    
    // ์ค‘๋ณต ๋ณ€์ˆ˜ ์ฒดํฌ
    const uniqueVars = new Set(variables);
    if (variables.length !== uniqueVars.size) {
      errors.push(`Duplicate variable in ${key}: ${value}`);
    }
    
    // ๋‹ซํžˆ์ง€ ์•Š์€ ๊ด„ํ˜ธ ์ฒดํฌ
    const openCount = (value.match(/\{\{/g) || []).length;
    const closeCount = (value.match(/\}\}/g) || []).length;
    if (openCount !== closeCount) {
      errors.push(`Unclosed brackets in ${key}: ${value}`);
    }
  });
  
  return errors;
}

// Jest ํ…Œ์ŠคํŠธ
describe('Translation Tests', () => {
  test('All locales have same keys', () => {
    const isComplete = checkTranslationCompleteness('ko', 'en');
    expect(isComplete).toBe(true);
  });
  
  test('No interpolation errors', () => {
    const translations = require('./locales/ko/common.json');
    const errors = validateInterpolation(translations);
    expect(errors).toHaveLength(0);
  });
});

4. ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •

๊ฐœ๋ฐœํ•  ๋•Œ ๋ฒˆ์—ญ ํ‚ค๊ฐ€ ๋ณด์ด๊ฒŒ ํ•˜๊ฑฐ๋‚˜, ๋ฒˆ์—ญ์ด ์—†๋Š” ๋ถ€๋ถ„์„ ๊ฐ•์กฐํ•˜๋ฉด ๋””๋ฒ„๊น…์ด ์‰ฌ์›Œ์ ธ. ๐Ÿ”

// ๊ฐœ๋ฐœ ๋ชจ๋“œ ์„ค์ •
i18n.init({
  debug: process.env.NODE_ENV === 'development',
  
  // ๊ฐœ๋ฐœ ๋ชจ๋“œ์—์„œ ํ‚ค ํ‘œ์‹œ
  returnNull: false,
  returnEmptyString: false,
  
  // ๋ฒˆ์—ญ ํ‚ค๋ฅผ ๊ทธ๋Œ€๋กœ ํ‘œ์‹œ
  ...(process.env.SHOW_KEYS && {
    lng: 'cimode'  // ํŠน์ˆ˜ ๋ชจ๋“œ
  })
});

// ๋ฒˆ์—ญ ๋ˆ„๋ฝ ํ•˜์ด๋ผ์ดํŠธ ์ปดํฌ๋„ŒํŠธ
function DevTranslation({ children, translationKey }) {
  const { i18n } = useTranslation();
  const exists = i18n.exists(translationKey);
  
  if (process.env.NODE_ENV === 'production') {
    return children;
  }
  
  return (
    <span
      style={{
        backgroundColor: exists ? 'transparent' : 'yellow',
        border: exists ? 'none' : '2px dashed red'
      }}
      title={exists ? '' : `Missing: ${translationKey}`}
    >
      {children}
    </span>
  );
}

// ์‚ฌ์šฉ
<DevTranslation translationKey="user.profile.title">
  {t('user.profile.title')}
</DevTranslation>

๐ŸŒ SEO์™€ ๊ตญ์ œํ™”

1. hreflang ํƒœ๊ทธ ์„ค์ •

๊ฒ€์ƒ‰ ์—”์ง„์—๊ฒŒ ๊ฐ ์–ธ์–ด ๋ฒ„์ „์˜ ํŽ˜์ด์ง€๊ฐ€ ์–ด๋”” ์žˆ๋Š”์ง€ ์•Œ๋ ค์ค˜์•ผ ํ•ด. ์•ˆ ๊ทธ๋Ÿฌ๋ฉด ์ค‘๋ณต ์ฝ˜ํ…์ธ ๋กœ ์ธ์‹๋  ์ˆ˜ ์žˆ์–ด. ๐Ÿ”

<head>
  <!-- ํ˜„์žฌ ํŽ˜์ด์ง€ ์–ธ์–ด -->
  <html lang="ko">
  
  <!-- ๋Œ€์ฒด ์–ธ์–ด ๋ฒ„์ „ -->
  <link rel="alternate" hreflang="ko" href="https://example.com/ko/page" />
  <link rel="alternate" hreflang="en" href="https://example.com/en/page" />
  <link rel="alternate" hreflang="ja" href="https://example.com/ja/page" />
  
  <!-- ๊ธฐ๋ณธ ์–ธ์–ด (์–ธ์–ด ๊ฐ์ง€ ์‹คํŒจ ์‹œ) -->
  <link rel="alternate" hreflang="x-default" href="https://example.com/" />
  
  <!-- ์ง€์—ญ๋ณ„ ๋ณ€ํ˜• -->
  <link rel="alternate" hreflang="en-US" href="https://example.com/en-us/page" />
  <link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/page" />
</head>

// React Helmet์œผ๋กœ ๋™์  ์ƒ์„ฑ
import { Helmet } from 'react-helmet';

function Page() {
  const alternateLinks = languages.map(lang => ({
    rel: 'alternate',
    hreflang: lang.code,
    href: `${baseUrl}/${lang.code}${pathname}`
  }));
  
  return (
    <Helmet>
      <html lang={currentLanguage} />
      {alternateLinks.map(link => (
        <link key={link.hreflang} {...link} />
      ))}
    </Helmet>
  );
}

2. URL ๊ตฌ์กฐ ์ „๋žต

๋‹ค๊ตญ์–ด ์‚ฌ์ดํŠธ์˜ URL์„ ์–ด๋–ป๊ฒŒ ๊ตฌ์„ฑํ• ์ง€๋Š” SEO์— ํฐ ์˜ํ–ฅ์„ ๋ฏธ์ณ. ๊ฐ ๋ฐฉ์‹๋งˆ๋‹ค ์žฅ๋‹จ์ ์ด ์žˆ์–ด. ๐Ÿ”—

๐ŸŒ URL ๊ตฌ์กฐ ์˜ต์…˜ 1. ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ: example.com/ko/, example.com/en/
โ€ข ์žฅ์ : ๊ด€๋ฆฌ ์‰ฌ์›€, ๋‹จ์ผ ๋„๋ฉ”์ธ
โ€ข ๋‹จ์ : ์ง€์—ญ๋ณ„ ์„œ๋ฒ„ ์ตœ์ ํ™” ์–ด๋ ค์›€

2. ์„œ๋ธŒ๋„๋ฉ”์ธ: ko.example.com, en.example.com
โ€ข ์žฅ์ : ์ง€์—ญ๋ณ„ ์„œ๋ฒ„ ๋ถ„๋ฆฌ ๊ฐ€๋Šฅ
โ€ข ๋‹จ์ : SEO ๊ถŒํ•œ ๋ถ„์‚ฐ

3. ๋ณ„๋„ ๋„๋ฉ”์ธ: example.kr, example.com
โ€ข ์žฅ์ : ์ง€์—ญ ํƒ€๊ฒŸํŒ… ์ตœ๊ณ 
โ€ข ๋‹จ์ : ๋น„์šฉ, ๊ด€๋ฆฌ ๋ณต์žก

4. ํŒŒ๋ผ๋ฏธํ„ฐ: example.com?lang=ko
โ€ข ์žฅ์ : ๊ตฌํ˜„ ๊ฐ„๋‹จ
โ€ข ๋‹จ์ : SEO์— ๋ถˆ๋ฆฌ, ๊ถŒ์žฅํ•˜์ง€ ์•Š์Œ
// Next.js ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ ๋ฐฉ์‹
// next.config.js
module.exports = {
  i18n: {
    locales: ['ko', 'en', 'ja'],
    defaultLocale: 'ko',
    localeDetection: true
  }
};

// ์ž๋™ ๋ผ์šฐํŒ…
// /ko/about -> pages/about.js (ํ•œ๊ตญ์–ด)
// /en/about -> pages/about.js (์˜์–ด)

// Express.js ์„œ๋ธŒ๋„๋ฉ”์ธ ๋ฐฉ์‹
app.use((req, res, next) => {
  const subdomain = req.subdomains[0];
  const supportedLocales = ['ko', 'en', 'ja'];
  
  if (supportedLocales.includes(subdomain)) {
    req.locale = subdomain;
  } else {
    req.locale = 'ko';
  }
  
  next();
});

// ์–ธ์–ด๋ณ„ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ
app.get('/', (req, res) => {
  const userLang = detectLanguage(req);
  res.redirect(`/${userLang}/`);
});

3. ๊ตฌ์กฐํ™”๋œ ๋ฐ์ดํ„ฐ (Schema.org)

๊ฒ€์ƒ‰ ์—”์ง„์ด ์ฝ˜ํ…์ธ ๋ฅผ ๋” ์ž˜ ์ดํ•ดํ•˜๋„๋ก ๊ตฌ์กฐํ™”๋œ ๋ฐ์ดํ„ฐ๋„ ๋‹ค๊ตญ์–ด๋กœ ์ œ๊ณตํ•ด์•ผ ํ•ด. ๐Ÿ“Š

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebPage",
  "name": "ํ™ˆํŽ˜์ด์ง€",
  "description": "์›น ๊ฐœ๋ฐœ ๊ฐ€์ด๋“œ",
  "inLanguage": "ko-KR",
  "url": "https://example.com/ko/",
  "potentialAction": {
    "@type": "ReadAction",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://example.com/ko/",
      "inLanguage": "ko-KR"
    }
  }
}
</script>

// React์—์„œ ๋™์  ์ƒ์„ฑ
function generateStructuredData(locale, content) {
  return {
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": content.title[locale],
    "description": content.description[locale],
    "inLanguage": locale,
    "author": {
      "@type": "Person",
      "name": content.author
    }
  };
}

๐ŸŽ“ ์‹ค์ „ ์˜ˆ์ œ: ์™„์ „ํ•œ ๋‹ค๊ตญ์–ด ์‚ฌ์ดํŠธ ๊ตฌ์ถ•

์ด์ œ ๋ฐฐ์šด ๊ฑธ ๋‹ค ํ•ฉ์ณ์„œ ์‹ค์ œ๋กœ ๋™์ž‘ํ•˜๋Š” ๋‹ค๊ตญ์–ด ์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“ค์–ด๋ณด์ž. ์žฌ๋Šฅ๋„ท ๊ฐ™์€ ํ”Œ๋žซํผ์—์„œ ๊ธ€๋กœ๋ฒŒ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด๋ณผ๊ฒŒ. ๐Ÿš€

1. ํ”„๋กœ์ ํŠธ ์ดˆ๊ธฐ ์„ค์ •

// package.json
{
  "dependencies": {
    "react": "^18.2.0",
    "react-i18next": "^13.0.0",
    "i18next": "^23.0.0",
    "i18next-browser-languagedetector": "^7.0.0",
    "i18next-http-backend": "^2.0.0"
  }
}

// ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ
src/
โ”œโ”€โ”€ i18n/
โ”‚   โ”œโ”€โ”€ config.js
โ”‚   โ””โ”€โ”€ locales/
โ”‚       โ”œโ”€โ”€ ko/
โ”‚       โ”‚   โ”œโ”€โ”€ common.json
โ”‚       โ”‚   โ”œโ”€โ”€ talent.json
โ”‚       โ”‚   โ””โ”€โ”€ marketplace.json
โ”‚       โ”œโ”€โ”€ en/
โ”‚       โ””โ”€โ”€ ja/
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ LanguageSwitcher.jsx
โ”‚   โ”œโ”€โ”€ TalentCard.jsx
โ”‚   โ””โ”€โ”€ LocalizedPrice.jsx
โ”œโ”€โ”€ hooks/
โ”‚   โ””โ”€โ”€ useLocalization.js
โ””โ”€โ”€ utils/
    โ””โ”€โ”€ formatters.js

2. i18n ์„ค์ •

// src/i18n/config.js
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend';

i18n
  .use(Backend)
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    fallbackLng: 'ko',
    supportedLngs: ['ko', 'en', 'ja'],
    
    detection: {
      order: ['querystring', 'localStorage', 'navigator'],
      caches: ['localStorage'],
      lookupQuerystring: 'lang'
    },
    
    backend: {
      loadPath: '/locales/{{lng}}/{{ns}}.json'
    },
    
    interpolation: {
      escapeValue: false,
      format: (value, format, lng) => {
        if (format === 'number') {
          return new Intl.NumberFormat(lng).format(value);
        }
        if (format === 'currency') {
          return new Intl.NumberFormat(lng, {
            style: 'currency',
            currency: getCurrency(lng)
          }).format(value);
        }
        return value;
      }
    },
    
    react: {
      useSuspense: true
    }
  });

function getCurrency(locale) {
  const currencyMap = {
    'ko': 'KRW',
    'en': 'USD',
    'ja': 'JPY'
  };
  return currencyMap[locale] || 'USD';
}

export default i18n;

3. ๋ฒˆ์—ญ ํŒŒ์ผ ์ž‘์„ฑ

// locales/ko/talent.json
{
  "marketplace": {
    "title": "์žฌ๋Šฅ ๋งˆ์ผ“ํ”Œ๋ ˆ์ด์Šค",
    "search": {
      "placeholder": "์–ด๋–ค ์žฌ๋Šฅ์„ ์ฐพ์œผ์‹œ๋‚˜์š”?",
      "button": "๊ฒ€์ƒ‰"
    },
    "category": {
      "programming": "ํ”„๋กœ๊ทธ๋ž˜๋ฐ",
      "design": "๋””์ž์ธ",
      "translation": "๋ฒˆ์—ญ",
      "consulting": "์ปจ์„คํŒ…"
    },
    "talent": {
      "price": "{{price, currency}}",
      "rating": "ํ‰์  {{rating}}",
      "reviews": "{{count}}๊ฐœ์˜ ๋ฆฌ๋ทฐ",
      "seller": "ํŒ๋งค์ž: {{name}}"
    }
  }
}

// locales/en/talent.json
{
  "marketplace": {
    "title": "Talent Marketplace",
    "search": {
      "placeholder": "What talent are you looking for?",
      "button": "Search"
    },
    "category": {
      "programming": "Programming",
      "design": "Design",
      "translation": "Translation",
      "consulting": "Consulting"
    },
    "talent": {
      "price": "{{price, currency}}",
      "rating": "Rating {{rating}}",
      "reviews": "{{count}} reviews",
      "reviews_plural": "{{count}} reviews",
      "seller": "Seller: {{name}}"
    }
  }
}

4. ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„

// components/LanguageSwitcher.jsx
import { useTranslation } from 'react-i18next';

const languages = [
  { code: 'ko', name: 'ํ•œ๊ตญ์–ด', flag: '๐Ÿ‡ฐ๐Ÿ‡ท' },
  { code: 'en', name: 'English', flag: '๐Ÿ‡บ๐Ÿ‡ธ' },
  { code: 'ja', name: 'ๆ—ฅๆœฌ่ชž', flag: '๐Ÿ‡ฏ๐Ÿ‡ต' }
];

export function LanguageSwitcher() {
  const { i18n } = useTranslation();
  
  const changeLanguage = (lng) => {
    i18n.changeLanguage(lng);
    document.documentElement.lang = lng;
    
    // ์–ธ์–ด ๋ณ€๊ฒฝ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
    window.dispatchEvent(new CustomEvent('languageChanged', {
      detail: { language: lng }
    }));
  };
  
  return (
    <div className="language-switcher">
      {languages.map(lang => (
        <button
          key={lang.code}
          onClick={() => changeLanguage(lang.code)}
          className={i18n.language === lang.code ? 'active' : ''}
        >
          <span>{lang.flag}</span>
          <span>{lang.name}</span>
        </button>
      ))}
    </div>
  );
}

// components/TalentCard.jsx
import { useTranslation } from 'react-i18next';

export function TalentCard({ talent }) {
  const { t } = useTranslation('talent');
  
  return (
    <div className="talent-card">
      <img src={talent.image} alt={talent.title} />
      <h3>{talent.title}</h3>
      <p className="price">
        {t('marketplace.talent.price', { price: talent.price })}
      </p>
      <div className="rating">
        {t('marketplace.talent.rating', { rating: talent.rating })}
      </div>
      <div className="reviews">
        {t('marketplace.talent.reviews', { count: talent.reviewCount })}
      </div>
      <p className="seller">
        {t('marketplace.talent.seller', { name: talent.sellerName })}
      </p>
    </div>
  );
}

// components/LocalizedPrice.jsx
export function LocalizedPrice({ amount, currency }) {
  const { i18n } = useTranslation();
  
  const formatted = new Intl.NumberFormat(i18n.language, {
    style: 'currency',
    currency: currency || getCurrency(i18n.language)
  }).format(amount);
  
  return <span className="price">{formatted}</span>;
}

5. ์ปค์Šคํ…€ ํ›… ํ™œ์šฉ

// hooks/useLocalization.js
import { useTranslation } from 'react-i18next';
import { useMemo } from 'react';

export function useLocalization() {
  const { t, i18n } = useTranslation();
  
  const formatDate = useMemo(() => {
    return (date, options = {}) => {
      return new Intl.DateTimeFormat(i18n.language, {
        year: 'numeric',
        month: 'long',
        day: 'numeric',
        ...options
      }).format(new Date(date));
    };
  }, [i18n.language]);
  
  const formatNumber = useMemo(() => {
    return (number, options = {}) => {
      return new Intl.NumberFormat(i18n.language, options).format(number);
    };
  }, [i18n.language]);
  
  const formatCurrency = useMemo(() => {
    return (amount, currency) => {
      return new Intl.NumberFormat(i18n.language, {
        style: 'currency',
        currency: currency || getCurrency(i18n.language)
      }).format(amount);
    };
  }, [i18n.language]);
  
  const formatRelativeTime = useMemo(() => {
    return (date) => {
      const rtf = new Intl.RelativeTimeFormat(i18n.language, {
        numeric: 'auto'
      });
      
      const diff = new Date(date) - new Date();
      const days = Math.round(diff / (1000 * 60 * 60 * 24));
      
      if (Math.abs(days) < 1) {
        const hours = Math.round(diff / (1000 * 60 * 60));
        return rtf.format(hours, 'hour');
      }
      
      return rtf.format(days, 'day');
    };
  }, [i18n.language]);
  
  return {
    t,
    i18n,
    formatDate,
    formatNumber,
    formatCurrency,
    formatRelativeTime,
    currentLanguage: i18n.language,
    isRTL: ['ar', 'he', 'fa'].includes(i18n.language)
  };
}

// ์‚ฌ์šฉ ์˜ˆ์‹œ
function TalentList() {
  const { t, formatCurrency, formatRelativeTime } = useLocalization();
  
  return (
    <div>
      <h2>{t('marketplace.title')}</h2>
      {talents.map(talent => (
        <div key={talent.id}>
          <h3>{talent.title}</h3>
          <p>{formatCurrency(talent.price)}</p>
          <p>{formatRelativeTime(talent.createdAt)}</p>
        </div>
      ))}
    </div>
  );
}

โš ๏ธ ํ”ํ•œ ์‹ค์ˆ˜์™€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

1. ํ•˜๋“œ์ฝ”๋”ฉ๋œ ํ…์ŠคํŠธ

โŒ ๋‚˜์œ ์˜ˆ์‹œ
<button>์ €์žฅ</button>
alert('์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค');

โœ… ์ข‹์€ ์˜ˆ์‹œ
<button>{t('common.button.save')}</button>

alert(t('common.message.saved'));

์ฝ”๋“œ ๋ฆฌ๋ทฐํ•  ๋•Œ ํ•˜๋“œ์ฝ”๋”ฉ๋œ ํ…์ŠคํŠธ๋ฅผ ์ฐพ๋Š” ์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•˜๋ฉด ๋„์›€์ด ๋ผ:

// ESLint ๊ทœ์น™์œผ๋กœ ํ•˜๋“œ์ฝ”๋”ฉ ๋ฐฉ์ง€
// .eslintrc.js
module.exports = {
  rules: {
    'no-literal-string': ['error', {
      exclude: ['className', 'style', 'type']
    }]
  }
};

// ๋˜๋Š” ์ปค์Šคํ…€ ๋ฆฐํŠธ ๊ทœ์น™
function checkHardcodedStrings(code) {
  const koreanRegex = /[๊ฐ€-ํžฃ]+/g;
  const matches = code.match(koreanRegex);
  
  if (matches) {
    console.warn('Hardcoded Korean strings found:', matches);
  }
}

2. ๋‚ ์งœ/์ˆซ์ž ํฌ๋งท ๋ฌด์‹œ

โŒ ๋‚˜์œ ์˜ˆ์‹œ const date = '2024-01-15';
const price = '$' + amount;

โœ… ์ข‹์€ ์˜ˆ์‹œ
const date = formatDate(new Date('2024-01-15'));
const price = formatCurrency(amount, 'USD');

3. ๋ฒˆ์—ญ ํ‚ค ์ค‘๋ณต

๊ฐ™์€ ํ‚ค๋ฅผ ์—ฌ๋Ÿฌ ํŒŒ์ผ์— ์ •์˜ํ•˜๋ฉด ๋‚˜์ค‘์— ์–ด๋–ค ๊ฒŒ ์‚ฌ์šฉ๋˜๋Š”์ง€ ํ—ท๊ฐˆ๋ ค. ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ๋ช…ํ™•ํžˆ ๊ตฌ๋ถ„ํ•ด์•ผ ํ•ด. ๐Ÿ”‘

// ์ค‘๋ณต ์ฒดํฌ ์Šคํฌ๋ฆฝํŠธ
function findDuplicateKeys(localesPath) {
  const allKeys = {};
  const duplicates = [];
  
  // ๋ชจ๋“  JSON ํŒŒ์ผ ์ฝ๊ธฐ
  const files = glob.sync(`${localesPath}/**/*.json`);
  
  files.forEach(file => {
    const content = JSON.parse(fs.readFileSync(file, 'utf8'));
    const keys = flattenObject(content);
    
    Object.keys(keys).forEach(key => {
      if (allKeys[key]) {
        duplicates.push({
          key,
          files: [allKeys[key], file]
        });
      } else {
        allKeys[key] = file;
      }
    });
  });
  
  return duplicates;
}

4. ๋ฌธ๋งฅ ๋ฌด์‹œํ•œ ๋ฒˆ์—ญ

"Close"๋ฅผ ๋ฌด์กฐ๊ฑด "๋‹ซ๊ธฐ"๋กœ ๋ฒˆ์—ญํ•˜๋ฉด "๊ฐ€๊นŒ์šด"์ด๋ผ๋Š” ์˜๋ฏธ์ผ ๋•Œ ์ด์ƒํ•ด์ ธ. ์ปจํ…์ŠคํŠธ๋ฅผ ๋ช…์‹œํ•ด์•ผ ํ•ด.

// ๋‚˜์œ ์˜ˆ์‹œ
{
  "close": "๋‹ซ๊ธฐ"
}

// ์ข‹์€ ์˜ˆ์‹œ
{
  "button": {
    "close": "๋‹ซ๊ธฐ"
  },
  "distance": {
    "close": "๊ฐ€๊นŒ์šด"
  },
  "relationship": {
    "close": "์นœ๋ฐ€ํ•œ"
  }
}

// ๋˜๋Š” ์ปจํ…์ŠคํŠธ ์‚ฌ์šฉ
{
  "close_button": "๋‹ซ๊ธฐ",
  "close_distance": "๊ฐ€๊นŒ์šด"
}

5. ์„ฑ๋Šฅ ์ตœ์ ํ™” ๋ฌด์‹œ

๋ชจ๋“  ๋ฒˆ์—ญ์„ ํ•œ ๋ฒˆ์— ๋กœ๋“œํ•˜๋ฉด ์ดˆ๊ธฐ ๋กœ๋”ฉ์ด ๋А๋ ค์ ธ. ํ•„์š”ํ•œ ๊ฒƒ๋งŒ ๋กœ๋“œํ•˜๋Š” ๊ฒŒ ์ค‘์š”ํ•ด. โšก

๐Ÿ’ก ์„ฑ๋Šฅ ์ตœ์ ํ™” ์ฒดํฌ๋ฆฌ์ŠคํŠธ
  • โœ“ ์ฝ”๋“œ ์Šคํ”Œ๋ฆฌํŒ…: ํŽ˜์ด์ง€๋ณ„๋กœ ๋ฒˆ์—ญ ํŒŒ์ผ ๋ถ„๋ฆฌ
  • โœ“ ์ง€์—ฐ ๋กœ๋”ฉ: ์ดˆ๊ธฐ ํ™”๋ฉด์— ๋ถˆํ•„์š”ํ•œ ๋ฒˆ์—ญ ์ง€์—ฐ
  • โœ“ ์บ์‹ฑ: ๋ฒˆ์—ญ ํŒŒ์ผ ์ ๊ทน์ ์œผ๋กœ ์บ์‹ฑ
  • โœ“ CDN: ์ •์  ๋ฒˆ์—ญ ํŒŒ์ผ์€ CDN์—์„œ ์ œ๊ณต
  • โœ“ ์••์ถ•: JSON ํŒŒ์ผ Gzip/Brotli ์••์ถ•

๐ŸŽฏ ๋งˆ๋ฌด๋ฆฌํ•˜๋ฉฐ

์™€, ์—ฌ๊ธฐ๊นŒ์ง€ ์ฝ์—ˆ๋‹ค๋ฉด ์ •๋ง ๋Œ€๋‹จํ•ด! ๐Ÿ‘ ์›น ๊ตญ์ œํ™”๋Š” ์ฒ˜์Œ์—” ๋ณต์žกํ•ด ๋ณด์ด์ง€๋งŒ, ์ฒด๊ณ„์ ์œผ๋กœ ์ ‘๊ทผํ•˜๋ฉด ์ถฉ๋ถ„ํžˆ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์–ด.

ํ•ต์‹ฌ์€ ์ฒ˜์Œ๋ถ€ํ„ฐ ๊ตญ์ œํ™”๋ฅผ ์—ผ๋‘์— ๋‘๊ณ  ์„ค๊ณ„ํ•˜๋Š” ๊ฑฐ์•ผ. ๋‚˜์ค‘์— ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ์ „์ฒด ์ฝ”๋“œ๋ฅผ ๋‹ค์‹œ ๋งŒ๋“ค์–ด์•ผ ํ•  ์ˆ˜๋„ ์žˆ๊ฑฐ๋“ . ํŠนํžˆ ์žฌ๋Šฅ๋„ท์ฒ˜๋Ÿผ ๊ธ€๋กœ๋ฒŒ ์‹œ์žฅ์„ ๋ชฉํ‘œ๋กœ ํ•˜๋Š” ํ”Œ๋žซํผ์ด๋ผ๋ฉด ๋”์šฑ ์ค‘์š”ํ•ด.

๐ŸŽ“ ํ•ต์‹ฌ ์š”์•ฝ 1. ์•„ํ‚คํ…์ฒ˜: ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ๊ตฌ์กฐ๋กœ ์‹œ์ž‘
2. ๋ฒˆ์—ญ ๊ด€๋ฆฌ: ์ „๋ฌธ ๋„๊ตฌ ํ™œ์šฉ์œผ๋กœ ํšจ์œจ์„ฑ ํ–ฅ์ƒ
3. UI/UX: ์–ธ์–ด๋ณ„ ํŠน์„ฑ ๊ณ ๋ คํ•œ ๋””์ž์ธ
4. ์„ฑ๋Šฅ: ๋ถ„ํ•  ๋กœ๋”ฉ๊ณผ ์บ์‹ฑ์œผ๋กœ ์ตœ์ ํ™”
5. SEO: hreflang๊ณผ ๊ตฌ์กฐํ™”๋œ ๋ฐ์ดํ„ฐ ํ™œ์šฉ
6. ํ…Œ์ŠคํŠธ: ์ž๋™ํ™”๋œ ๊ฒ€์ฆ์œผ๋กœ ํ’ˆ์งˆ ๋ณด์žฅ

๊ตญ์ œํ™”๋Š” ๋‹จ์ˆœํžˆ ๊ธฐ์ˆ ์ ์ธ ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์˜ ๋ฌธ์ œ์•ผ. ์ „ ์„ธ๊ณ„ ์‚ฌ์šฉ์ž๋“ค์ด ์ž์‹ ์˜ ์–ธ์–ด๋กœ ํŽธํ•˜๊ฒŒ ์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“œ๋Š” ๊ฒƒ, ๊ทธ๊ฒŒ ์ง„์ •ํ•œ ๊ธ€๋กœ๋ฒŒ ์„œ๋น„์Šค์ง€. ๐ŸŒ

์ฒ˜์Œ์—” ์–ด๋ ค์›Œ ๋ณด์—ฌ๋„ ํ•˜๋‚˜์”ฉ ์ ์šฉํ•˜๋‹ค ๋ณด๋ฉด ์–ด๋А์ƒˆ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋‹ค๊ตญ์–ด ์ง€์›์ด ๋˜์–ด ์žˆ์„ ๊ฑฐ์•ผ. ํ™”์ดํŒ…! ๐Ÿ’ช

๐Ÿš€ Global Web Development Making the web accessible to everyone, everywhere
๋Œ“๊ธ€ ์ž‘์„ฑ

์ด ๊ธ€์— ๋Œ€ํ•œ ์—ฌ๋Ÿฌ๋ถ„์˜ ์ƒ๊ฐ์„ ๋“ค๋ ค์ฃผ์„ธ์š”

๋Œ“๊ธ€ 0
๋Œ“๊ธ€์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘์ž…๋‹ˆ๋‹ค.

์•„์ง ๋Œ“๊ธ€์ด ์—†์Šต๋‹ˆ๋‹ค.