From e2ceff4a4d281f935bb063f1894097109097697c Mon Sep 17 00:00:00 2001 From: john Date: Tue, 10 May 2022 17:55:03 +0700 Subject: [PATCH] support i18n --- src/components/SideBar.js | 2 +- src/i18.js | 59 +++++++++++++++++++++++++++++++++++++++ src/index.js | 1 + src/lang/en.js | 0 src/lang/fr.js | 0 src/lang/tw.js | 0 6 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/i18.js create mode 100644 src/lang/en.js create mode 100644 src/lang/fr.js create mode 100644 src/lang/tw.js diff --git a/src/components/SideBar.js b/src/components/SideBar.js index 1f41aad..d45f667 100644 --- a/src/components/SideBar.js +++ b/src/components/SideBar.js @@ -13,7 +13,7 @@ const menuItems = [ ] const docItems = [ - { name: 'Anouncement', icon: '', path: '' }, + { name: 'Announcement', icon: '', path: '' }, { name: 'FAQ', icon: '', path: '' }, { name: 'Tutorial', icon: '', path: '' }, ] diff --git a/src/i18.js b/src/i18.js new file mode 100644 index 0000000..f11f3a5 --- /dev/null +++ b/src/i18.js @@ -0,0 +1,59 @@ +import i18n from 'i18next' +import { initReactI18next } from 'react-i18next' + +const resources = { + en: { + translation: { + home: 'Home', + farm: 'farm', + announcement: 'Announcement', + faq: 'FAQ', + tutorial: 'tutorial', + connectWallet: 'Connect Wallet', + tvl: 'TVL', + totalUsersEarned: 'Total Users Earned', + personalTvl: 'Personal TVL', + totalPersonalEarned: 'Total Personal Earned', + harvest: 'Harvest', + apy: 'APY', + compoundInterest: 'Compound Interest', + deposite: 'Deposite', + vl: 'VL', + remaining: 'Remaining', + withdrawal: 'Withdrawal', + mining: 'Mining', + defiFarm: 'Defi Farm', + multiChainLockupValue: 'Multi-chain Lock-up Value', + multiChainUserRevenue: 'Multi-chain User Revenue', + miningOutput: 'Mining Output', + miningOutputValue: 'Mining Output Value', + multiChainReward: 'Multi-chain Reward', + multiChainBurned: 'Multi-chain Burned', + more: 'More', + partners: 'Partners', + auditors: 'Auditors', + } + }, + fr: { + translation: { + + } + }, + tw: { + translation: { + + } + }, +} + +i18n.use(initReactI18next).init({ + resources, + lng: 'en', // language to use. + fallbackLng: 'en', + debug: process.env.NODE_ENV === 'development', + interpolation: { + escapeValue: false + } +}) + +export default i18n; \ No newline at end of file diff --git a/src/index.js b/src/index.js index 0cdf37a..8931b42 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,7 @@ import { ColorModeScript } from '@chakra-ui/react'; import React, { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; +import i18n from './i18' import App from './App'; import { Home, Farm } from './pages' import reportWebVitals from './reportWebVitals'; diff --git a/src/lang/en.js b/src/lang/en.js new file mode 100644 index 0000000..e69de29 diff --git a/src/lang/fr.js b/src/lang/fr.js new file mode 100644 index 0000000..e69de29 diff --git a/src/lang/tw.js b/src/lang/tw.js new file mode 100644 index 0000000..e69de29