-
Notifications
You must be signed in to change notification settings - Fork 384
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
1 parent
dd05206
commit 56c3adc
Showing
9 changed files
with
107 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import I18n from 'i18n-js'; | ||
|
||
const InitI18n = (railsContext) => { | ||
I18n.translations = railsContext.translations; | ||
I18n.defaultLocale = railsContext.i18nDefaultLocale; | ||
I18n.fallbacks = true; | ||
}; | ||
|
||
const SelectLanguage = (onChange) => ( | ||
<select onChange={(e) => onChange(e.target.value)} > | ||
<option value="en">English</option> | ||
<option value="de">Deutsch</option> | ||
<option value="ja">日本語</option> | ||
<option value="zh-CN">简体中文</option> | ||
<option value="zh-TW">正體中文</option> | ||
</select> | ||
); | ||
|
||
const SetI18nLocale = (locale) => { | ||
I18n.locale = locale; | ||
}; | ||
|
||
export { InitI18n, SelectLanguage, SetI18nLocale }; |
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
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