-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: Module not found: Error: Can't resolve 'react-hot-loader/webpack' * add IntlProvider for mulit language support * add some sample translation * fix warning on console * Revert "Fix: Module not found: Error: Can't resolve 'react-hot-loader/webpack'" This reverts commit f02318f. * Revert "fix warning on console" This reverts commit 3fcb3e7. * use yarn * attempt to fix indent * use a single line here
- Loading branch information
1 parent
ad342af
commit 5873964
Showing
8 changed files
with
81 additions
and
13 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,15 @@ | ||
import { addLocaleData } from 'react-intl'; | ||
import jaLocaleData from 'react-intl/locale-data/ja'; | ||
import ja from '@/locale/ja'; | ||
|
||
const chooseLocale = (language) => { | ||
switch (language.split('_')[0]) { | ||
// case 'zh': | ||
// return 'zh_CN'; | ||
default: | ||
addLocaleData(jaLocaleData); | ||
return { lang: 'ja', message: ja }; | ||
} | ||
}; | ||
|
||
export default chooseLocale; |
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,7 @@ | ||
import { injectIntl, intlShape } from 'react-intl'; | ||
|
||
const ChildComponent = ({ intl, id, values }) => intl.formatMessage({ id }, values); | ||
|
||
ChildComponent.propTypes = { intl: intlShape.isRequired }; | ||
|
||
export default injectIntl(ChildComponent); |
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,2 @@ | ||
export chooseLocale from '@/locale/chooseLocale'; | ||
export FormatMessage from '@/locale/format'; |
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,6 @@ | ||
const ja = { | ||
初登场: '初登场', | ||
前日x位: '前日 {rank}位' | ||
}; | ||
|
||
export default ja; |
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