Unverified Commit 2378077d authored by Stefan Auditor's avatar Stefan Auditor Committed by Stefan Auditor
Browse files

Issue #3282696 by sanduhrs: Port of l10n_community: Fix progress bar

parent 390ed77c
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -66,16 +66,23 @@ function template_preprocess_l10n_community_progress_columns(array &$variables)

  if ($sum == 0) {
    // We handle a project without any source strings available for translation.
    return [
      ['data' => t('No data available yet.'), 'colspan' => 3],
    ];
    $variables['bar'] = t('No data available yet.');
    return;
  }

  // Compute numbers, percentages and provide alternate text titles.
  $done_percent = round($translated / $sum * 100, 2);
  $status = [
    'translated' => [(int) $translated, $done_percent, t('!percent translated')],
    'untranslated' => [$sum - $translated, 100 - $done_percent, t('!percent untranslated')],
    'translated' => [
      $translated,
      $done_percent,
      t('!percent translated'),
    ],
    'untranslated' => [
      $sum - $translated,
      100 - $done_percent,
      t('!percent untranslated'),
    ],
    // suggestions are not in the bar as they overlap with both translated and
    // untranslated strings, so we cannot display them here.
  ];