API page: https://api.drupal.org/api/drupal/includes%21locale.inc/function/_locale...

The $report parameter documentation is incorrect, following it would throw notices.

Comments

slydevil created an issue. See original summary.

slydevil’s picture

Priority: Normal » Minor
Status: Active » Needs review
StatusFileSize
new513 bytes

Patch attached.

slydevil’s picture

Issue summary: View changes
poker10’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this looks good! It is true that the function uses different array keys and the patch fixes it.

function _locale_import_one_string_db(&$report, $langcode, $context, $source, $translation, $textgroup, $location, $mode, $plid = 0, $plural = 0) {
  ...
  if (!empty($translation)) {
    ...
    if ($textgroup == "default" && !locale_string_is_safe($translation)) {
      ...
      $report['skips']++;
      ...
    }
    elseif ($lid) {
      ...
      if (!$exists) {
        ...
        $report['additions']++;
        ...
      }
      elseif ($mode == LOCALE_IMPORT_OVERWRITE) {
        ...
        $report['updates']++;
        ...
      }
    }
    else {
      ...
      $report['additions']++;
      ...
    }
  }
  elseif ($mode == LOCALE_IMPORT_OVERWRITE) {
    ...
    $report['deletes']++;
    ...
  }
  ...
}

  • poker10 committed 78cd79cd on 7.x
    Issue #3068195 by slydevil: Documentation for...

poker10 credited mcdruid.

poker10’s picture

Status: Reviewed & tested by the community » Fixed

This got +1 from @mcdruid on Slack, so committed. Thanks @slydevil!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.