Lingo.dev + .csv (Data)
Lingo.dev CLI translates CSV files with a specific structure. It updates the provided CSV file by adding columns with translations for each target locale. The CLI preserves the exact CSV format and delimiters, handles UTF-8 and various character encodings safely, and works seamlessly with Excel, Google Sheets, and database imports.
How CSV Translation Works
CSV files must have the following structure:
- First column named
KEY
- A source locale column (e.g.,
en
)
The CLI expands the supplied CSV file to include columns for each target locale (e.g., es
, fr
). Translations are filled in for each target locale, while the original content is preserved.
Example: Source and Output
Input file (English source):
KEY,en
dashboard.title,Dashboard
greeting.message,Hello world!
button.label,Submit
Output file (after translation to Spanish and French):
KEY,en,es,fr
dashboard.title,Dashboard,Panel de control,Tableau de bord
greeting.message,Hello world!,¡Hola mundo!,Bonjour le monde!
button.label,Submit,Enviar,Soumettre
- The
KEY
column is preserved. - The source locale column (
en
) remains unchanged. - New columns for each target locale (
es
,fr
) are added, with translations filled in.
Quick Setup
To configure CSV translation, add a bucket for your CSV files in i18n.json
:
{
"locale": {
"source": "en",
"targets": ["es", "fr"]
},
"buckets": {
"csv": {
"include": ["i18n/data.csv"]
}
}
}
Translate CSV Data
npx lingo.dev@latest i18n
The CLI preserves CSV structure, headers, and data types while translating text content in the target columns.
Advanced Features
Custom Delimiter Support
Works with various CSV dialects:
- Comma-separated:
value1,value2,value3
- Semicolon-separated:
value1;value2;value3
- Tab-separated:
value1\tvalue2\tvalue3
Advanced Configuration
Multiple CSV Files
"csv": {
"include": [
"i18n/data.csv",
"content/static/*.csv"
]
}