Closed zhangyugege closed 4 years ago
While t
is the main function to access all the translations - there are functions on i18n
that you might need or not need (exist, dir, language, ... https://www.i18next.com/overview/api) -> does it hurt to pass it down - no...
While
t
is the main function to access all the translations - there are functions oni18n
that you might need or not need (exist, dir, language, ... https://www.i18next.com/overview/api) -> does it hurt to pass it down - no...
But i think i18next is a litte too big.... Does its size affect the first screen rendering?
How should it...it's on the server it's in the request object and gets passed to your template handler or can be used for serverside rendering eg. a react tree -> it's not on the client...you don't res.send(i18n)
How should it...it's on the server it's in the request object and gets passed to your template handler or can be used for serverside rendering eg. a react tree -> it's not on the client...you don't res.send(i18n)
Oh i suddenly realized, thank you very much!:poop:
And i have an idea about if the amount of locale data is too large, we can get it asynchronously via i18next-xhr-backend
. A webapp, for example, requires thousands of locale datas. Is my idea feasible?
that's what it does...you can structure your translations into multiple namespaces and load them on demand
that's what it does...you can structure your translations into multiple namespaces and load them on demand
yeah!
Hello ~ I see that the middleware on the node server depends on the
i18n-express-middleware
library.In
i18n-express-middleware
, it pass the entire i18n example to the front end via ctx.req.Source code at: https://github.com/i18next/i18next-express-middleware/blob/master/src/index.js#L60
Why would you pass the entire i18n instance to ctx.req, is there anything special in it?:sparkles::seedling:Why not just pass locales data to the front end? Can you answer it for me, thank you~