Skip to content

Commit

Permalink
Count translations instead of translation sets
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-mendonca committed Feb 16, 2024
1 parent ed86d97 commit 081dc46
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions gp-templates/gptoolbox-translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@
$translations_by_translation_set = array();

// Set general translation counts.
$translations_with_active_original_count = 0;
$translations_with_obsolete_original_count = 0;
$translations_with_unknown_original_count = 0;
$unknown_translation_sets = 0;
$translations_with_active_original_count = 0;
$translations_with_obsolete_original_count = 0;
$translations_with_unknown_original_count = 0;
$translations_from_unknown_translation_sets = 0;

foreach ( $gp_translations as $translation_id => $translation ) {
$translations_by_translation_set[ $translation->translation_set_id ][ $translation_id ] = $translation;
Expand All @@ -152,7 +152,7 @@

foreach ( $translations_by_translation_set as $translation_set_id => $translations ) {
if ( ! isset( $gp_translation_sets[ $translation_set_id ] ) ) {
++$unknown_translation_sets;
$translations_from_unknown_translation_sets += count( $translations_by_translation_set[ $translation_set_id ] );
}
}

Expand Down Expand Up @@ -198,10 +198,10 @@
_n( '%s translation with unknown original.', '%s translations with unknown originals.', $translations_with_unknown_original_count, 'gp-toolbox' ),
'<strong class="translations-label translations-label-unknown">' . esc_html( number_format_i18n( $translations_with_unknown_original_count ) ) . '</strong>'
) . '</a>' : '',
$unknown_translation_sets > 0 ? '<a id="translations-unknown-translation-set" class="translations" href="#translations">' . sprintf(
/* translators: %s: Number of Translation Sets. */
_n( 'Translations from %s unknown translation set.', 'Translations from %s unknown translation sets.', $unknown_translation_sets, 'gp-toolbox' ),
'<strong class="translations-label translations-label-unknown">' . esc_html( number_format_i18n( $unknown_translation_sets ) ) . '</strong>'
$translations_from_unknown_translation_sets > 0 ? '<a id="translations-unknown-translation-set" class="translations" href="#translations">' . sprintf(
/* translators: %s: Number of Translations. */
_n( '%s translation from unknown translation set.', '%s translations from unknown translation sets.', $translations_from_unknown_translation_sets, 'gp-toolbox' ),
'<strong class="translations-label translations-label-unknown">' . esc_html( number_format_i18n( $translations_from_unknown_translation_sets ) ) . '</strong>'
) . '</a>' : ''
)
);
Expand Down

0 comments on commit 081dc46

Please sign in to comment.