Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow syncing the translations for a specific locale #405

Open
nicwortel opened this issue Feb 18, 2020 · 2 comments
Open

Allow syncing the translations for a specific locale #405

nicwortel opened this issue Feb 18, 2020 · 2 comments

Comments

@nicwortel
Copy link
Contributor

nicwortel commented Feb 18, 2020

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 the translation:sync command, similar to the locale argument that can be passed to translation:extract? So when omitted the command will continue to work as it does now, but when you supply the locale 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 the StorageService::sync() method, the StorageService::mergeUp() method and the StorageService::mergeDown() method. The mergeUp() method calls getCatalogues() on the CatalogueFetcher, which already supports a $locales array. The mergeDown() method calls StorageService::download(), where we could also add a $locale parameter to download only translations for a single locale.

@welcoMattic
Copy link
Member

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?

@Nyholm
Copy link
Member

Nyholm commented Apr 8, 2020

I like the feature.
Isnt this very related to #378?

I mean, could one use exportOptions to support this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants