-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Selective locale-check #3601
base: 8.x
Are you sure you want to change the base?
Selective locale-check #3601
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,6 +24,13 @@ function locale_drush_command() { | |||||
$items['locale-check'] = [ | ||||||
'description' => 'Checks for available translation updates.', | ||||||
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL, | ||||||
'options' => [ | ||||||
'projects' => 'A comma separated and no space list of interface translation projects language to update. If omitted, all the installed projects will be updated.', | ||||||
], | ||||||
'examples' => [ | ||||||
'drush locale-check' => 'Language update for all installed interface translation projects.', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command does not update, it only checks.
Suggested change
I removed the word "installed" as this is not relevant. Not installed projects are never checked. |
||||||
'drush locale-check --projects=custom_module,paragraphs' => 'Language update for custom_module and paragraphs.', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above.
Suggested change
|
||||||
], | ||||||
]; | ||||||
$items['locale-update'] = [ | ||||||
'description' => 'Updates the available translations.', | ||||||
|
@@ -45,13 +52,22 @@ function locale_drush_command() { | |||||
* in Drupal core. | ||||||
*/ | ||||||
function drush_locale_check() { | ||||||
// Prepare the projects array. | ||||||
$projects = drush_get_option('projects', NULL); | ||||||
if (!empty($projects)) { | ||||||
$projects = array_filter(explode(',', $projects)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As suggested by Moshe
Suggested change
|
||||||
} | ||||||
else { | ||||||
$projects = []; | ||||||
} | ||||||
|
||||||
\Drupal::moduleHandler()->loadInclude('locale', 'inc', 'locale.compare'); | ||||||
|
||||||
// Check translation status of all translatable project in all languages. | ||||||
// First we clear the cached list of projects. Although not strictly | ||||||
// necessary, this is helpful in case the project list is out of sync. | ||||||
locale_translation_flush_projects(); | ||||||
locale_translation_check_projects(); | ||||||
locale_translation_check_projects($projects); | ||||||
|
||||||
// Execute a batch if required. A batch is only used when remote files | ||||||
// are checked. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't make the user think, fix this in code by proper treatment of the input.