extractor icon indicating copy to clipboard operation
extractor copied to clipboard

Extraction on existing project with translations in YAML files

Open denrique88 opened this issue 7 years ago • 2 comments

Hello,

In an existing project running on Symfony 2.8, I have all my translations done in YAML files (as the Symfony documentation recommend it). The YAML files are in the Resources/translations directory of each bundle of the project.

I installed the php-translation bundle and did an extract of the translations of my application with the command : app/console translation:extract app

My problem is that all the existing translations aren't imported in the XLF files, so it seems that I should insert all the 1500 translations of my app again.

Is there a possibility for importing the existing translations ? If not, I would be interested in helping to implement this functionnality.

David

denrique88 avatar Feb 26 '18 12:02 denrique88

I answer to myself. I created two commands :

  • the first one make an export of the translation before the extraction in a json file
  • the second one make an import of the translation from a json file after the extract

I tested my commands and it works : my old YAML translations are correctly imported in the new translation catalog.

denrique88 avatar Feb 27 '18 09:02 denrique88

Thank you for coming back with an answer. I assume you are using the symfony bundle and not just the extractor library. The ~bundle~ symfony core should pick up all existing translation in your yaml files and store them in memory. When the bundle's extract command has been running it will try to merge all translations.

Nyholm avatar Mar 23 '18 19:03 Nyholm