module.exports = {
module: {
rules: [
{
test: /\.i18next\.json$/,
use: [{ loader: path.resolve(__dirname, 'i18next-json-loader') }],
},
]
}
}
{
"en": {
"name": "Name",
"age": "Age"
},
"de": {
"name": "Name",
"age": "Alter"
}
}
import React from 'react'
import { I18n } from 'react-i18next'
import translations from './MyComponent.i18next.json'
export const MyComponent = () => {
return (
<I18n ns={translations.namespace}>
{t => (
<div>
<div>{t('name')}</div>
<div>{t('age')}</div>
</div>
)}
</I18n>
)
}