This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Gina Contrino
committed
Nov 3, 2017
1 parent
0a7345d
commit 248776b
Showing
12 changed files
with
46 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
import i18n from 'i18next'; // eslint-disable-line import/no-extraneous-dependencies | ||
import languages from './languages'; | ||
import setup from '../../i18n/i18n-setup'; | ||
|
||
const resources = Object.keys(languages).reduce((accumulator, key) => { | ||
accumulator[key] = { | ||
common: languages[key].common, | ||
}; | ||
return accumulator; | ||
}, {}); | ||
|
||
i18n | ||
.init({ | ||
fallbackLng: 'en', | ||
resources, | ||
lang: 'en', | ||
ns: ['common'], | ||
defaultNS: 'common', | ||
saveMissing: true, | ||
debug: false, | ||
keySeparator: '>', | ||
nsSeparator: '|', | ||
}); | ||
const i18n = setup(); | ||
|
||
export default i18n; |
This file was deleted.
Oops, something went wrong.
File renamed without changes
File renamed without changes
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,27 @@ | ||
import i18n from 'i18next'; | ||
import languages from './languages'; | ||
|
||
const setup = () => { | ||
const resources = Object.keys(languages).reduce((accumulator, key) => { | ||
accumulator[key] = { | ||
common: languages[key].common, | ||
}; | ||
return accumulator; | ||
}, {}); | ||
|
||
|
||
return i18n | ||
.init({ | ||
fallbackLng: 'en', | ||
resources, | ||
lang: 'en', | ||
ns: ['common'], | ||
defaultNS: 'common', | ||
saveMissing: true, | ||
debug: false, | ||
keySeparator: '>', | ||
nsSeparator: '|', | ||
}); | ||
}; | ||
|
||
export default setup; |
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,13 @@ | ||
const languages = { | ||
en: { | ||
name: 'English', | ||
common: require('./locales/en/common.json'), | ||
flag: require('./flags/en.png'), | ||
}, | ||
de: { | ||
name: 'Deutsch', | ||
common: require('./locales/de/common.json'), | ||
flag: require('./flags/de.png'), | ||
}, | ||
}; | ||
export default languages; |
File renamed without changes.
File renamed without changes.
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 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 |
---|---|---|
@@ -1,43 +1,5 @@ | ||
import i18n from 'i18next'; | ||
import languages from './constants/languages'; | ||
import setup from '../i18n/i18n-setup'; | ||
|
||
const resources = Object.keys(languages).reduce((accumulator, key) => { | ||
accumulator[key] = { | ||
common: languages[key].common, | ||
}; | ||
return accumulator; | ||
}, {}); | ||
|
||
i18n | ||
.init({ | ||
fallbackLng: 'en', | ||
resources, | ||
react: { | ||
// wait: true, // globally set to wait for loaded translations in translate hoc | ||
// exposeNamespace: true // exposes namespace on data-i18next-options to be used in eg. | ||
}, | ||
|
||
// have a common namespace used around the full app | ||
ns: ['common'], | ||
defaultNS: 'common', | ||
|
||
keySeparator: '>', | ||
nsSeparator: '|', | ||
|
||
debug: false, | ||
|
||
// cache: { | ||
// enabled: true, | ||
// }, | ||
|
||
interpolation: { | ||
escapeValue: false, // not needed for react!! | ||
formatSeparator: ',', | ||
format: (value, format) => { | ||
if (format === 'uppercase') return value.toUpperCase(); | ||
return value; | ||
}, | ||
}, | ||
}); | ||
const i18n = setup(); | ||
|
||
export default i18n; |