Closed uside closed 2 years ago
Thank you so much for this. I'll test this tomorrow on a project. However something we'd need is to handle both TS and JS files for this to be useful for a much people as possible.
I just tested and it works perfectly!
Just a couple more requests.
configureServer
part is doing.$locales/en.js
instead of ../../locales/en.js
? Although relative imports continue to work for javascript files, which is awesome because that means this improvement is not breaking.I can add third argument for plugin initialization that receives event emitter with async load
method
const BigCorpLocales = new EventEmitter();
BigCorpLocales.load = async (localeCode) => {
return asyncLoadLocaleFromService(localeCode);
};
BigCorpLocales.emit('change', 'en');
precompileIntl('src/locales', '$locales', BigCorpLocales);
Let's keep it focused on the Jason thing, but I think it could be usefulin the future
Thanks! I'll release a new minor version
By default it handles
$locales/en.ts
import, reads contents ofen.json
file and precompile it on the fly. Live reload supported too.svelte.config.js:
__layout.svelte:
src/locales/en.json: