Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Notes #1

Open
tricoder42 opened this issue Sep 21, 2018 · 6 comments
Open

Notes #1

tricoder42 opened this issue Sep 21, 2018 · 6 comments

Comments

@tricoder42
Copy link

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 need compileNamespace=window.LINGUI_INIT, but for dynamically loading catalogs we need regular cjs or es export.

  • lingui extract --watch (or lingui watch) would be very useful to automatically extract messages.

  • i18n object could have method onLocaleRequest, where you could register callback (e.g. dynamic load of catalog) if locale is changed. Then we could use i18n.activate('en') to change active locale

So, 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.

@disintegrator
Copy link
Owner

Can't believe I forgot to say this sooner... Thank you for checking this work out! It's really great to have your support 🙂

@cjayyy
Copy link

cjayyy commented Jan 28, 2019

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

@tricoder42
Copy link
Author

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.

@cjayyy
Copy link

cjayyy commented Jan 28, 2019

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 :)

@iaincollins
Copy link

@disintegrator @tricoder42 Hi both!

Thanks so much for your work!

  • I've raised at PR at Fix for compatiblity with the latest version of Lingui #3 that relies in a hack to fix the current example, but might be a helpful part of the journey to work out a better approach (it seems there was a change in Lingui recently which has broken this example, but this addresses it, in a slightly terrible way but that I think is helpful to highlight the problem).
  • What's great about Lingui and this example repo is that it works really well with both isomorphic rendering and serverless (and is much less opinionated that other projects, which have dependancies like express, which in turn impact bundle functions and being able to run serverless on the edge, etc).
  • Perhaps either Linqui could generate multiple outputs to facilitate easier isomorphic rendering + SPA support, or export a UMD module, or just a script that works in an isomorphic way by checking it's environment (I have had success with both approaches on different modules).

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. :-)

@iaincollins
Copy link

iaincollins commented May 25, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants