Typesafe Internationalization with Svelte
A tiny Node.js based CLI that provides some tools to improve all things around i18n and a Svelte Store to enable typesafe internationalization.
Packages
- @t9n/cli - The CLI to generate typedefs and export/import xlsx files.
- @t9n/svelte - A Svelte Store to enable typesafe internationalization.
What is this for?
This lib is designed to support developers as well as translators and make their life easier. It:
- 📖 Makes translation keys type safe.
- 🚨 Shows developers and other stakeholders if translations are missing.
- 👜 Makes it easy to create a list of all used translation keys and extract something translation agencies can work with (xlsx ftw 👍).
- 🛬 Allows seamless imports of new translations.
The Workflow
Everything in this lib is built around the following workflow. Sure, use it however you like, but this was in our mind when we created it.
- Install the CLI ➡️ Installation
- Put all translation keys in the file (meta.json) and run
t9n typedefs <filename>
whenever it changes ➡️ CLI Docs
- Once the translations is created, run
t9n export <folderpath>
to create a xlsx-sheet for all translation keys. ➡️ CLI Docs
- Once the translation is done, import the translated xlsx with
t9n import <filename>
to create json files for every defined language. ➡️ CLI Docs
- To use these new translations adjust your config, if necessary. ➡️ Store Docs
Contributing
Contributions are always welcome!