Open nicwortel opened 4 years ago
Hi! Your working case seems legit for legacy application that use language as source, and I guess that you are not alone with this case.
The solution seems to me pretty nice because it cover another case, which is when you want to deploy your application as long as you're working an a new language implementation and want to avoid sync the WIP language translations. Here a $locales
parameter would be nice to sync only passed locales.
@php-translation/deciders WDYT?
I like the feature. Isnt this very related to https://github.com/php-translation/symfony-bundle/pull/378?
I mean, could one use exportOptions
to support this feature?
I would like to be able to specify a locale when running
bin/console translation:sync
, so that I can push translations of our source language (English) to the remote storage (direction = up, so that existing translations in the remote storage will be overwritten) without changing any of the translations that are stored there for other languages.The reason is that we commit our English translations (
messages.en.xlf
) in our repository and use them as our "source", while we gitignore all other translations and download them from Loco as part of our build process. We want to be able to change the English translations locally in our source code, commit those changes / merge them to master, and then let our CI pipeline push those changes to Loco, overwriting the English translations there. But we don't want to overwrite any changes to the translations for other locales that may have been made by translators in Loco.Would you be open for a pull request that adds an optional
locale
argument to thetranslation:sync
command, similar to thelocale
argument that can be passed totranslation:extract
? So when omitted the command will continue to work as it does now, but when you supply thelocale
argument only translations for that locale will be synchronized.As far as I can see the required change would be limited to adding a
$locale
argument to theStorageService::sync()
method, theStorageService::mergeUp()
method and theStorageService::mergeDown()
method. ThemergeUp()
method callsgetCatalogues()
on theCatalogueFetcher
, which already supports a$locales
array. ThemergeDown()
method callsStorageService::download()
, where we could also add a$locale
parameter to download only translations for a single locale.