svelte-lingui – i10n for Svelte
This is a first stab at building a reusable module for internationalization, localization and translation of Svelte and Sapper apps.
Installation
yarn add --dev svelte-lingui # or npm i --save-dev svelte-lingui
Usage
Wrap your app in a provider:
<Provider => <App /></Provider>
Use Text
component for messages:
<Text = = />
Or use context to access the i18n
object from Lingui directly:
const i18n = ; // returns a store$i18n
Checkout the code inside /dev
for a full example.
Development
There is a dev app available inside the /dev
folder that can be used for
testing and experimenting with the components. To start it simply run:
yarn dev # or npm run dev
Todo
- Evaluate other i18n/translation libraries (fluent + fluent-compiler, ttag, etc)
- Implement language detection/negotiation (client side + sapper middleware)
- Sapper routing