Open tricoder42 opened 6 years ago
Can't believe I forgot to say this sooner... Thank you for checking this work out! It's really great to have your support 🙂
Is there any progress on this issue? I am wondering how to edit the implementation to
support reloading of messages without page refresh @lingui/loader
Not directly, but I've just bootstrapped a Next.js project couple of days ago. I'm learning to use and understand the framework while working on LinguiJS v3. So, there is a progress, but still nothing specific. I should have more info in next few weeks.
Awesome, can't wait to see the results. Please refer to this thread in case of any ideas.
Thanks so much for great Lingui and your precious time! Love it :)
@disintegrator @tricoder42 Hi both!
Thanks so much for your work!
I'm happy to contribute to other items on this list if we can wrangle the this example back to a working state! I'm also hoping there is something I am missing about exports that someone can suggest when they see the problem. :-)
BTW, as announced at ReactEurope by @timneutkens, Next.js will have /api/
route support, which I think will be great for making it easy to facilitate loading catalogs in a Single Page App.
e.g. You could call an endpoint via fetch and have your app fetch and load a new catalog at run time without an app reload.
When this is working again (and the functionality settled) it would be great to see this example in next.js/examples, especially as it works so well with serverless deployments.
Hey @disintegrator, this looks really awesome!
I tried to improve it, but LinguiJS is missing few features:
to support reloading of messages without page refresh
@lingui/loader
need to receive a parameter, because for initial render we needcompileNamespace=window.LINGUI_INIT
, but for dynamically loading catalogs we need regular cjs or es export.lingui extract --watch
(orlingui watch
) would be very useful to automatically extract messages.i18n
object could have methodonLocaleRequest
, where you could register callback (e.g. dynamic load of catalog) if locale is changed. Then we could usei18n.activate('en')
to change active localeSo, I think for now you did the best what you can. I'll take a look next week how we could improve LinguiJS API to provide smoother implementation in SSR apps.