Description
Examples bug report
Example name
with-react-i18next
Describe the bug
If nested component uses namespace that is not specified in parent page component, than translation is not loaded on server side.
I've pushed code with bug reproduction here Yankovsky@d0d5f18
Also, I've recorded videos:
En language http://s.csssr.ru/U02D248T6/2018-09-28-1757-3wa83v4ypq.mp4
Notice how it works correctly if I start navigation from home page, but translations for home
namespace don't load if I start from page2.
For de language slightly different situation. For this example I've changed links so they include ?lng=de
param. From home page to page2 http://s.csssr.ru/U02D248T6/2018-09-28-1804-c1hs5sucpa.mp4 Notice, that for some reason en language for page2 was downloaded.
From page2 to home http://s.csssr.ru/U02D248T6/2018-09-28-1805-1zvklg3at4.mp4 Notice flickering and downloading of home.json.
To Reproduce
Check the code above.
Or you can just change ExtendedComponent from example to:
import React from 'react'
import { translate } from 'react-i18next'
function MyComponent ({ t }) {
return <p>{t('home:sample_button')}</p>
}
const Extended = translate('home')(MyComponent)
export default Extended
Here I changed translation from using common namespace to home namespace. Now try to open page2, translations don't work.
Expected behavior
Provide translations for all namespaces for all components on the page. Side bugs like flickering or unnecessary json download are fixed.
System information
- OS: macOS
- Browser: chrome
- Version of Next.js: 7.0.0