Comments (5)
Need more details...i18next.languages is empty there...can't be after initializing at least not if either you set a lng on init or use the browser-languagedetector....
from i18next-fluent.
I'm able to reproduce this issue server-side where I'm using i18nextMiddleware.LanguageDetector in a node.js express app. My i18next init looks like this:
i18next
.use(i18nextMiddleware.LanguageDetector)
.use(FilesystemBackend)
.use(Fluent)
.init({
debug: true,
fallbackLng: 'en',
preload: ['en', 'de'],
ns: ['translation', 'my.namespace'],
detection: {
order: ['cookie', 'querystring', 'header'],
lookupCookie: 'lang'
},
backend: {
loadPath: path.join(__dirname, '..', '..', 'client', 'build', 'locales/{{lng}}/{{ns}}.ftl'),
parse: function(data) {
return ftl2js(data);
}
}
});
It works if I set the lng
option, but then that bypasses the language detection.
from i18next-fluent.
On serverside that can't really work...not this way...language detection happens during request - not on init -> there is also not the main instance used but a cloned instance on request!!!
So https://github.com/i18next/i18next-fluent/blob/master/src/index.js#L66 has to be done based on languages in preload.
A PR would be very welcome...
from i18next-fluent.
@oasalonen If memory serves correctly I think that was the issue.
BTW, been using this library since this issue was created so kudos @jamuhl for creating this library!
from i18next-fluent.
thank you both for making this module better 👍
from i18next-fluent.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from i18next-fluent.