In l10n_update.bulk.inc around line 562-570:

  elseif (!empty($context['sandbox']['refresh']['strings'])) {
    // Not perfect but will give some indication of progress.
    $context['finished'] = 1 - count($context['sandbox']['refresh']['strings']) / $context['sandbox']['refresh']['count'];
    // Pending strings, refresh 100 at a time, get next pack.
    $next = array_slice($context['sandbox']['refresh']['strings'], 0, 100);
    array_splice($context['sandbox']['refresh']['strings'], 0, count($next));
    // Clear cache and force refresh of JavaScript translations.
    _l10n_update_refresh_translations($context['sandbox']['refresh']['languages'], $next);
  }

If you are unlucky enough to hit this particular code block, you have a problem. Because there is no function called _l10n_update_refresh_translations. Tried to search quickly after similarly named functions, but could not find any.

For my use case (I am running these batch things as part of an install procedure) I can work around it. But it seems like something that should be cleaned up in some way. Not sure what the function is supposed to do (well, I have an idea, but specifically :)). So if someone could provide any pointers I would gladly provide the patch myself.

For reference (this would be what people would google for) this would produce the following error:

Fatal error: Call to undefined function _l10n_update_refresh_translations() in /path/to/drupal/sites/all/modules/contrib/l10n_update/l10n_update.bulk.inc on line 569

Comments

eiriksm created an issue. See original summary.

eiriksm’s picture

Issue summary: View changes
Sutharsan’s picture

_l10n_update_refresh_translations should be a backport of the following D8 core code:

/**
 * Refresh related information after string translations have been updated.
 *
 * The information that will be refreshed includes:
 * - JavaScript translations.
 * - Locale cache.
 * - Render cache.
 *
 * @param array $langcodes
 *   Language codes for updated translations.
 * @param array $lids
 *   (optional) List of string identifiers that have been updated / created.
 *   If not provided, all caches for the affected languages are cleared.
 */
function _locale_refresh_translations($langcodes, $lids = array()) {
  if (!empty($langcodes)) {
    // Update javascript translations if any of the strings has a javascript
    // location, or if no string ids were provided, update all languages.
    if (empty($lids) || ($strings = \Drupal::service('locale.storage')->getStrings(array('lid' => $lids, 'type' => 'javascript')))) {
      array_map('_locale_invalidate_js', $langcodes);
    }
  }

  // Throw locale.save_translation event.
  \Drupal::service('event_dispatcher')->dispatch(LocaleEvents::SAVE_TRANSLATION, new LocaleEvent($langcodes, $lids));
}