Internationalization (i18n)
LibreFolio supports multiple languages to ensure accessibility for a global audience. The frontend uses svelte-i18n for managing translations and locale switching.
Supported Languages
Currently, the following languages are supported:
- ๐ฌ๐ง English (
en) - Default - ๐ฎ๐น Italian (
it) - ๐ซ๐ท French (
fr) - ๐ช๐ธ Spanish (
es)
Architecture
Translations are stored in JSON files located in src/lib/i18n/.
src/lib/i18n/
โโโ en.json # Source of truth
โโโ it.json
โโโ fr.json
โโโ es.json
โโโ index.ts # Configuration and initialization
Usage in Components
To use translations in Svelte components, import the t store:
<script>
import { t } from '$lib/i18n';
</script>
<h1>{$t('dashboard.welcome')}</h1>
<p>{$t('common.save')}</p>
Dynamic Values
You can pass variables to translation strings:
Managing Translations
We provide a CLI tool to help manage translations and ensure consistency.
Audit Missing Keys
To check for missing translations across all language files:
Adding a New Key
To add a new key to all language files simultaneously:
Updating a Key
To update an existing key: