Skip to content
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

733: Add counts to filter links in the translation page. #741

Merged
merged 3 commits into from Jun 28, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 46 additions & 9 deletions gp-templates/translations.php
Expand Up @@ -75,18 +75,55 @@
<?php
$filter_links = array();
$filter_links[] = gp_link_get( $url, __( 'All', 'glotpress' ) );
$untranslated = gp_link_get( add_query_arg( array('filters[status]' => 'untranslated', 'sort[by]' => 'priority', 'sort[how]' => 'desc'), $url ), __( 'Untranslated', 'glotpress' ) );
$untranslated .= '&nbsp;('.gp_link_get( add_query_arg( array('filters[status]' => 'untranslated', 'sort[by]' => 'random'), $url ), __( 'random', 'glotpress' ) ).')';
$filter_links[] = $untranslated;

$untranslated_filters = array(
'filters[status]' => 'untranslated',
'sort[by]' => 'priority',
'sort[how]' => 'desc',
);

$filter_links[] = gp_link_get(
add_query_arg( $untranslated_filters, $url ),
// Translators: %d is the untranslated strings count for the current translation set.
sprintf( __( 'Untranslated&nbsp;[%d]&nbsp;(random)', 'glotpress' ), $translation_set->untranslated_count() )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use number_format_i18n() for numbers (and %s for the placeholder).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random was a separate link.

);

if ( $can_approve ) {
$filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'yes', 'filters[status]' => 'waiting'), $url ),
__( 'Waiting', 'glotpress' ) );
$filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'yes', 'filters[status]' => 'fuzzy'), $url ),
__( 'Fuzzy', 'glotpress' ) );
$filter_links[] = gp_link_get( add_query_arg( array('filters[warnings]' => 'yes', 'filters[status]' => 'current_or_waiting', 'sort[by]' => 'translation_date_added'), $url ),
__( 'Warnings', 'glotpress' ) );
$waiting_filters = array(
'filters[translated]' => 'yes',
'filters[status]' => 'waiting',
);

$filter_links[] = gp_link_get(
add_query_arg( $waiting_filters, $url ),
// Translators: %d is the waiting strings count for the current translation set.
sprintf( __( 'Waiting&nbsp;[%d]', 'glotpress' ), $translation_set->waiting_count() )
);

$fuzzy_filters = array(
'filters[translated]' => 'yes',
'filters[status]' => 'fuzzy',
);

$filter_links[] = gp_link_get(
add_query_arg( $fuzzy_filters, $url ),
// Translators: %d is the fuzzy strings count for the current translation set.
sprintf( __( 'Fuzzy&nbsp;[%d]', 'glotpress' ), $translation_set->fuzzy_count() )
);

$warning_filters = array(
'filters[warnings]' => 'yes',
'filters[status]' => 'current_or_waiting',
'sort[by]' => 'translation_date_added',
);

$filter_links[] = gp_link_get(
add_query_arg( $warning_filters, $url ),
// Translators: %d is the strings with warnings count for the current translation set.
sprintf( __( 'Warnings&nbsp;[%d]', 'glotpress' ), $translation_set->warnings_count() )
);
}

// TODO: with warnings
// TODO: saved searches
echo implode( '&nbsp;<span class="separator">&bull;</span>&nbsp;', $filter_links );
Expand Down