๐ 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
LibreFolio provides a full CLI toolkit for managing translation files via ./dev.py i18n.
๐ Audit
Check for missing, extra, or duplicate keys across all language files:
# Basic audit โ missing and extra keys
./dev.py i18n audit
# Include duplicate value detection
./dev.py i18n audit --duplicates
# Output as formatted table
./dev.py i18n audit --format table
# Export audit results to Excel
./dev.py i18n audit --output report.xlsx
| Flag | Description |
|---|---|
--duplicates |
Also report keys with identical values across languages |
--format |
Output format (text, table) |
--output FILE |
Save report to file (.xlsx for Excel) |
โ Add, Update, Remove Keys
# Add a new key to ALL language files
./dev.py i18n add "dashboard.new_feature" --en "New Feature" --it "Nuova Funzionalitร " --fr "Nouvelle Fonctionnalitรฉ" --es "Nueva Caracterรญstica"
# Update an existing key in specific languages
./dev.py i18n update "dashboard.title" --en "My Dashboard" --it "La mia Dashboard"
# Remove a key from all language files
./dev.py i18n remove "obsolete.key"
# Remove without confirmation prompt
./dev.py i18n remove "obsolete.key" -f
๐ Search & Explore
# Search for keys or values containing a query
./dev.py i18n search "broker"
# Search only in keys
./dev.py i18n search "broker" -k
# Search only in values
./dev.py i18n search "broker" -v
# Search in a specific language
./dev.py i18n search "courtier" -l fr
# Show key tree structure
./dev.py i18n tree
# Show tree for a prefix with key counts
./dev.py i18n tree "fx" --counts