diff --git a/.expo/types/router.d.ts b/.expo/types/router.d.ts index a1baba98..ac353cbd 100644 --- a/.expo/types/router.d.ts +++ b/.expo/types/router.d.ts @@ -7,7 +7,7 @@ declare module "expo-router" { export * from 'expo-router/build'; // prettier-ignore - type StaticRoutes = `/` | `/_layout` | `/answer` | `/create` | `/createHotelAgree` | `/createHotelName` | `/createHotelSelect` | `/feekCharge` | `/gingercard` | `/letter` | `/letterCompleted` | `/login` | `/mailbox` | `/modal` | `/navigation/` | `/push` | `/tabs/hotels` | `/tabs/my` | `/tabs/village`; + type StaticRoutes = `/` | `/answer` | `/create` | `/createHotelAgree` | `/createHotelName` | `/createHotelSelect` | `/feekCharge` | `/gingercard` | `/lang/i18n` | `/letter` | `/letterCompleted` | `/login` | `/mailbox` | `/modal` | `/navigation/` | `/push` | `/tabs/hotels` | `/tabs/my` | `/tabs/village` | `/_layout`; // prettier-ignore type DynamicRoutes = `/${CatchAllRoutePart}`; // prettier-ignore diff --git a/app/lang/i18n.ts b/app/lang/i18n.ts new file mode 100644 index 00000000..ccbc0cc7 --- /dev/null +++ b/app/lang/i18n.ts @@ -0,0 +1,61 @@ +import i18n from "i18next"; +import { initReactI18next } from "react-i18next"; + +const resource = { + en: { + translation: { + // 마이페이지 + "My Membership": "My Membership", + "My Code": "My Code", + "My Key": "My Key", + "My Peek": "My Peek", + "HotelModify": "Modifying My Hotel", + "Membership": "Membership", + "Terms of Use": "Terms of Use", + "Privacy Policy": "Privacy Policy", + "CS Center": "CS Center", + "Team Ginger": "Team Ginger", + "gingerhotel_welcome": "gingerhotel_welcome", + "Busniess": "Business Registration Number: 202-58-00723 CEO: Minji Kang", + "Address": "Address: 16, Seodaemun-ro 7-gil, Jung-gu, Seoul, Room 508-3", + "Email": "Email: teamgingerkr@gmail.com", + } + }, + ko: { + translation: { + // 마이페이지 + "My Membership": "내 멤버쉽", + "My Code": "내 코드", + "My Key": "내 열쇠", + "My Peek": "내 엿보기", + "HotelModify": "호텔수정", + "Membership": "멤버쉽", + "Terms of Use": "이용약관", + "Privacy Policy": "개인정보 처리방침", + "CS Center": "고객센터", + "Team Ginger": "팀진저", + "gingerhotel_welcome": "진저호텔", + "Busniess": "사업자등록번호 : 202-58-00723 대표이사 강민지", + "Address": "주소 : 서울특별시 중구 서대문로7길 16 508-3호", + "Email": "이메일 : teamgingerkr@gmail.com", + } + } +} + +i18n + .use(initReactI18next) + .init({ + resources:resource, + // 초기 설정 언어 + lng: "ko", + fallbackLng: "ko", + debug: true, + defaultNS: "translations", + ns: "translations", + keySeparator: false, + interpolation: { + escapeValue: false + } + }) + +export default i18n; \ No newline at end of file diff --git a/app/navigation/index.tsx b/app/navigation/index.tsx index 56d94721..943ad573 100644 --- a/app/navigation/index.tsx +++ b/app/navigation/index.tsx @@ -27,7 +27,7 @@ import Header from "../../components/appHeader"; import { SvgImg } from "../../components/svgImg"; import { MonoText } from "../../components/styledText"; import FeekCharge from "../feekCharge"; - +import "../lang/i18n" // 다국어 파일 const Tab = createBottomTabNavigator(); const Stack = createStackNavigator(); diff --git a/app/tabs/my.tsx b/app/tabs/my.tsx index 0dd137e9..8002f1ad 100644 --- a/app/tabs/my.tsx +++ b/app/tabs/my.tsx @@ -13,9 +13,13 @@ import { WithLocalSvg } from "react-native-svg"; import axios from "axios"; import AsyncStorage from "@react-native-async-storage/async-storage"; +import { useTranslation } from "react-i18next"; + const keySvg = require("../../assets/icon/i_key.svg"); const glassesSvg = require("../../assets/icon/i_glasses.svg"); +const { t, i18n } = useTranslation() + interface User { nickname: string; code: string; @@ -118,7 +122,7 @@ export default function TabThreeScreen({ navigation }: any) { fontFamily: "NanumSquareNeo-Variable", }} > - 내 멤버쉽 + {t('My Membership')} - 내 코드 + {t('My Code')} = 23.2.3", + "react": ">= 16.8.0" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -18640,6 +18713,14 @@ "resolved": "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz", "integrity": "sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==" }, + "node_modules/void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", diff --git a/package.json b/package.json index 748407b3..24480efb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,8 @@ "@react-navigation/native": "^6.1.9", "@react-navigation/stack": "^6.3.18", "@react-oauth/google": "^0.11.1", + "@types/i18next": "^13.0.0", + "@types/react-i18next": "^8.1.0", "axios": "^1.6.0", "expo": "~49.0.11", "expo-font": "~11.4.0", @@ -30,10 +32,12 @@ "expo-status-bar": "~1.6.0", "expo-system-ui": "~2.4.0", "expo-web-browser": "~12.3.2", + "i18next": "^23.7.6", "jwt-decode": "^3.1.2", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.48.2", + "react-i18next": "^13.5.0", "react-native": "0.72.6", "react-native-btr": "^2.2.0", "react-native-eject": "^0.2.0", @@ -47,9 +51,9 @@ "react-native-web": "~0.19.6", "react-navigation": "^5.0.0", "react-navigation-helpers": "^2.3.1", + "recoil": "^0.7.7", "styled-components": "^6.1.1", - "typeface-nanum-square-neo": "^0.0.6", - "recoil": "^0.7.7" + "typeface-nanum-square-neo": "^0.0.6" }, "devDependencies": { "@babel/core": "^7.20.0",