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 all commits
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
59 changes: 49 additions & 10 deletions gp-templates/translations.php
Expand Up @@ -74,19 +74,58 @@
<a href="#" class="revealing sort"><?php _e( 'Sort &darr;', 'glotpress' ); ?></a> <strong class="separator">&bull;</strong>
<?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;

// Translators: %s is the total strings count for the current translation set.
$filter_links[] = gp_link_get( $url, sprintf( __( 'All&nbsp;(%s)', 'glotpress' ), number_format_i18n( $translation_set->all_count() ) ) );

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

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

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: %s is the waiting strings count for the current translation set.
sprintf( __( 'Waiting&nbsp;(%s)', 'glotpress' ), number_format_i18n( $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: %s is the fuzzy strings count for the current translation set.
sprintf( __( 'Fuzzy&nbsp;(%s)', 'glotpress' ), number_format_i18n( $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: %s is the strings with warnings count for the current translation set.
sprintf( __( 'Warnings&nbsp;(%s)', 'glotpress' ), number_format_i18n( $translation_set->warnings_count() ) )
);
}

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