Simple commands to manage translations in Symfony.
This bundle allows you to write missing translations from a yml file to another requesting the missing translations and storing them in the output file.
For each non found translation it will request the translation showing the field id and the original text to translate, making it very easy to update your translation files when you have added fields to them
** It currently only suports yml translations files
Just require the bundle with composer:
composer.phar require davidrojo/sf-translations-helper
And then add it to app/AppKernel.php:
public function registerBundles()
{
$bundles = [
...
new DavidRojo\SfTranslationHelper\SfTranslationsBundle(),
...
]
}
}
Execute the command
php bin/console translations:helper [from_language] [to_language] [BundleName|File] [allowEmpty]
Arguments:
from Origin language file (example: en)
to Destination language file (example: fr)
file Bundle name or the full path from current folder to the input file
addEmpty Optional (true/false), Add empty values to the destination
file if no translation is added (default: false)
Options:
--no-backup If not present a .backup file will be generated if output file exists
$ php bin/console translations:helper en fr AppBundle
Destination file already exists. Override? (y/n): y
Counting missing translations...3 missing, 0 empty
Field id: delete
Original: Eliminar
Please enter the translation: Effacer
Field id: courses.create
Original: Crear curso
Please enter the translation: Créer un cours
Field id: total
Original: Total
Please enter the translation: Total
Saving file.
File saved at /AppBundle//Resources/translations/messages.fr.yml
Just open an issue or send a pull request and if it fits it will be integrated.
If you liked this bundle and saved you a little of time, you can:
- buy me a coffe
- buy me a dinner
- buy me a good dinner
- buy me a phpstorm license
- pay my rent
- buy me a car
- buy me a super car
;)