-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,096 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import i18n from 'i18next'; | ||
import { initReactI18next } from 'react-i18next'; | ||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
|
||
import translationZH_TW from './locales/zh_TW/translation.json'; | ||
|
||
export const resources = { | ||
zh_TW: { | ||
translation: translationZH_TW, | ||
}, | ||
zh: { | ||
translation: translationZH_TW, | ||
}, | ||
}; | ||
|
||
const initI18n = () => { | ||
i18n | ||
.use(initReactI18next) | ||
.use(LanguageDetector) | ||
.init({ | ||
resources, | ||
fallbackLng: 'zh_TW', | ||
debug: false, | ||
detection: { | ||
order: ['querystring', 'localStorage', 'htmlTag'], | ||
lookupQuerystring: 'lang', | ||
lookupLocalStorage: 'i18nextLng', | ||
caches: ['localStorage'], | ||
}, | ||
interpolation: { | ||
escapeValue: false, | ||
}, | ||
}) | ||
.then(); | ||
}; | ||
|
||
export default initI18n; |
9 changes: 9 additions & 0 deletions
9
nsysu_selector_helper/src/i18n/locales/zh_TW/translation.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"loading": "載入中...", | ||
"selector-helper": "中山大學課程選課小幫手", | ||
"all-courses": "所有課程", | ||
"semester-compulsory": "學期必修", | ||
"course-detective": "課程偵探", | ||
"selected-export": "已選匯出", | ||
"announcements": "公告" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App.tsx' | ||
import './index.css' | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App.tsx'; | ||
import './index.css'; | ||
import initI18n from '@/i18n/i18nConfig.ts'; | ||
|
||
initI18n(); | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App/> | ||
<App /> | ||
</React.StrictMode>, | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,8 @@ | |
|
||
"@": ["./src"], | ||
"@/*": ["./src/*"] | ||
} | ||
}, | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["src"] | ||
} |
Oops, something went wrong.