generated from arvinxx/monorepo-template
-
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
10 changed files
with
108 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import createI18n from '@arvinxu/i18n'; | ||
import localeMessageMaps from '../locales'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export const { IntlProvider, useFormatMessage } = createI18n(localeMessageMaps); | ||
export const useFormatMessage = () => { | ||
const { t } = useTranslation(); | ||
|
||
return (id, values?) => t(id, values); | ||
}; |
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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
import pages from './login'; | ||
|
||
export default pages; |
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,6 +1,26 @@ | ||
import type { LocaleMessageMaps } from '@arvinxu/i18n'; | ||
import i18n from 'i18next'; | ||
import { initReactI18next } from 'react-i18next'; | ||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
|
||
import zhCN from './zh-CN'; | ||
import en from './en-US'; | ||
|
||
const resources = { | ||
en: { translation: en }, | ||
'zh-CN': { translation: zhCN }, | ||
}; | ||
|
||
i18n | ||
.use(initReactI18next) | ||
|
||
.use(LanguageDetector) | ||
.init({ | ||
resources, | ||
|
||
const localeMessageMaps: LocaleMessageMaps = { 'zh-CN': zhCN }; | ||
fallbackLng: 'zh-CN', | ||
interpolation: { | ||
escapeValue: false, // react already safes from xss | ||
}, | ||
}); | ||
|
||
export default localeMessageMaps; | ||
export default i18n; |
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
import login from './login'; | ||
import register from './register'; | ||
|
||
export default { ...login, ...register }; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.