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

Import multiple custom translation po files #4235

Open
davidferlay opened this issue Oct 29, 2019 · 6 comments
Open

Import multiple custom translation po files #4235

davidferlay opened this issue Oct 29, 2019 · 6 comments

Comments

@davidferlay
Copy link

davidferlay commented Oct 29, 2019

Is your feature request related to a problem? Please describe.

  • Drush already provides a command to import individual custom translation po files, such as :
    drush locale:import fr /var/www/html/translations/fr.po --type=customized --override=all
  • This command requires to be duplicated when you want to import files for multiples languages, making things messy
  • It also requires you to know for which languages you have translations files or not

Describe the solution you'd like

  • Drush could provide a similar command to import multiple po files :

    • It would allow to streamline the process of importing custom translations on projects, regardless of enabled languages and available po files
  • Proposal : drush locale:import:all $directory $options

    • The command would require files to be named with valid 2 char language code
    • It would take a directory path as argument
    • It would offer the same options (type + override)
    • it would import only translations for installed modules and enabled languages
    • It would import only updated and new translations
  • Exemple : drush locale:import:all /var/www/html/translations/ --type=customized --override=all

Describe alternatives you've considered

  • https://www.drupal.org/project/drush_language brings drush locale-import-all :
    • The feature seem critical enough to be brought by Drush itself rather than a contrib module
    • Most likely code of this module will be a good source of inspiration
@andypost
Copy link
Contributor

On other hand it could be polished as "drush_language" and added to core as part of https://www.drupal.org/project/drupal/issues/2242947

@geek-merlin
Copy link
Contributor

As a drush_language maintainer, i'll support any approach to move this to core, via drush or not. My gut feeling is that going drush and later core makes sense.

@davidferlay
Copy link
Author

davidferlay commented Nov 13, 2019

Tested locally, works perfectly with drush locale:import:all /var/www/html/translations/ --type=customized --override=all and similar commands, using po files like this one (to rename as .po).

PR was done from Drush version : 10.0.3-dev

  • Drush provides new command drush locale:import:all $directory $options
  • The command requires files to be named with valid 2 char language code
  • It takes a directory path as argument
  • It offers the same options (type + override)
  • it imports only translations for installed modules and enabled languages
  • It imports only updated and new translations

2019-11-12_13-47

  • Looks like some CI check need to be fixed

@davidferlay
Copy link
Author

CI fixed!)

@davidferlay
Copy link
Author

davidferlay commented Nov 15, 2019

Any feedback @geek-merlin ? When PR is merged, we may backport it to drush 9 too btw

@ptmkenny
Copy link
Contributor

Is there any way or plan to export custom translations as well via drush?

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

No branches or pull requests

5 participants