Files from Symfony
Translate a Symfony XLIFF translation file
Symfony keeps an app's translations in translations/messages.<locale>.xlf. Open the file here, translate it with each string's key beside it, and save it back in place for the Translation component — free, in your browser.
It opens in the editor in this browser tab. Nothing is uploaded.
Steps
- Find or extract the file. Symfony keeps translations in translations/, one file per domain and locale: messages.fr.xlf, validators.fr.xlf, or messages+intl-icu.fr.xlf for ICU messages. php bin/console translation:extract --force fr adds the keys your code uses to the French files.
- Open it here. Drop it above. Each trans-unit (XLIFF 1.2) or unit (XLIFF 2.0) is a row, and its key, the resname or name attribute, is shown in the Details panel beside the string.
- Translate the targets. Keys that translation:extract added carry a stand-in target made of the key with a __ prefix, such as __app.welcome. Type __ in the filter's Target contains box to list them, and replace each one. A unit with no target gets one when you translate it.
- Export and put it back. Choose Export (Ctrl+S) and save the file over the original in translations/. In production, clear the cache (php bin/console cache:clear) so Symfony loads the new translations.
When the source is a key
If your project translates keys, the source of each row is the key itself, app.welcome rather than an English sentence, and the English text lives in messages.en.xlf. In Chrome or Edge, choose the translations folder instead of one file, and switch to the English file from the list when a key does not explain itself.
Parameters and ICU messages
Parameters stay text in the file. The placeholder check reads {name} as a whole, but %name% only by its first letter, %n: a dropped %name% is flagged, a renamed one such as %nom% is not. ICU messages in a +intl-icu file are not parsed either, so QA will not notice a translated plural or select keyword, and a one-word branch such as one {item} is reported as a placeholder mismatch even when its translation is right. Check those rows by eye.
What comes back unchanged
Ids, resname and name attributes, notes, the <header> Symfony writes and every unit you did not touch are written back byte for byte, entity references such as © included. Each target you translate gets a standard XLIFF state: on the <target> in 1.2, on the <segment> in 2.0. Symfony checks XLIFF files against the XLIFF schema when it loads them, and an added target goes straight after its source, where the schema expects it.
Not yet tested with Symfony
We have not run a file through Symfony's own import yet. What is tested is the file itself: everything outside the targets you edited comes back byte for byte as it arrived, which is what an importer depends on. If Symfony refuses a file from here, please send it to us.