name, $project->name ) ); gp_breadcrumb( array( gp_project_links_from_root( $project ), gp_link_get( $url, $translation_set->name ), ) ); gp_enqueue_scripts( array( 'gp-editor', 'gp-translations-page' ) ); wp_localize_script( 'gp-translations-page', '$gp_translations_options', array( 'sort' => __( 'Sort', 'glotpress' ), 'filter' => __( 'Filter', 'glotpress' ), ) ); // localizer adds var in front of the variable name, so we can't use $gp.editor.options $editor_options = compact( 'can_approve', 'can_write', 'url', 'discard_warning_url', 'set_priority_url', 'set_status_url' ); wp_localize_script( 'gp-editor', '$gp_editor_options', $editor_options ); gp_tmpl_header(); $i = 0; ?>

name ), esc_html( $translation_set->name ) ); ?>

'current_or_waiting_or_fuzzy_or_untranslated', ); $current_filter_class = array( 'class' => 'filter-current', ); $is_current_filter = ( array() === array_diff( $all_filters, $filters_and_sort ) || array() === $filters_and_sort ) && ! $additional_filters && ! $warnings_filter; $current_filter = $is_current_filter ? 'all' : $current_filter; $filter_links[] = gp_link_get( $url, // Translators: %s is the total strings count for the current translation set. sprintf( __( 'All (%s)', 'glotpress' ), number_format_i18n( $translation_set->all_count() ) ), $is_current_filter ? $current_filter_class : array() ); $translated_filters = array( 'filters[status]' => 'current', ); $is_current_filter = array() === array_diff( $translated_filters, $filters_and_sort ) && false === $additional_filters && ! $warnings_filter; $current_filter = $is_current_filter ? 'translated' : $current_filter; $filter_links[] = gp_link_get( add_query_arg( $translated_filters, $url ), // Translators: %s is the translated strings count for the current translation set. sprintf( __( 'Translated (%s)', 'glotpress' ), number_format_i18n( $translation_set->current_count() ) ), $is_current_filter ? $current_filter_class : array() ); $untranslated_filters = array( 'filters[status]' => 'untranslated', ); $is_current_filter = array() === array_diff( $untranslated_filters, $filters_and_sort ) && false === $additional_filters && ! $warnings_filter; $current_filter = $is_current_filter ? 'untranslated' : $current_filter; $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 (%s)', 'glotpress' ), number_format_i18n( $translation_set->untranslated_count() ) ), $is_current_filter ? $current_filter_class : array() ); $waiting_filters = array( 'filters[status]' => 'waiting', ); $is_current_filter = array() === array_diff( $waiting_filters, $filters_and_sort ) && ! $additional_filters && ! $warnings_filter; $current_filter = $is_current_filter ? 'waiting' : $current_filter; $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 (%s)', 'glotpress' ), number_format_i18n( $translation_set->waiting_count() ) ), $is_current_filter ? $current_filter_class : array() ); $fuzzy_filters = array( 'filters[status]' => 'fuzzy', ); $is_current_filter = array() === array_diff( $fuzzy_filters, $filters_and_sort ) && ! $additional_filters && ! $warnings_filter; $current_filter = $is_current_filter ? 'fuzzy' : $current_filter; $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 (%s)', 'glotpress' ), number_format_i18n( $translation_set->fuzzy_count() ) ), $is_current_filter ? $current_filter_class : array() ); $warning_filters = array( 'filters[warnings]' => 'yes', ); $is_current_filter = array() === array_diff( $warning_filters, $filters_and_sort ) && ! $additional_filters && ! array_key_exists( 'status', $filters_and_sort ); $current_filter = $is_current_filter ? 'warning' : $current_filter; $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 (%s)', 'glotpress' ), number_format_i18n( $translation_set->warnings_count() ) ), $is_current_filter ? $current_filter_class : array() ); // If no filter has been selected yet, then add the current filter count to the end of the filter links array. if ( '' === $current_filter ) { // Build an array or query args to add to the link using the current sort/filter options. $custom_filter = array(); foreach ( $filters_values_only as $key => $value ) { $custom_filter[ 'filters[' . $key . ']' ] = $value; } foreach ( $sort_values_only as $key => $value ) { $custom_filter[ 'sort[' . $key . ']' ] = $value; } $filter_links[] = gp_link_get( add_query_arg( $custom_filter, $url ), // Translators: %s is the strings with the current filter count for the current translation set. sprintf( __( 'Current Filter (%s)', 'glotpress' ), number_format_i18n( $total_translations_count ) ), $current_filter_class ); } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo implode( ' ', $filter_links ); ?>
text_direction ? ' translation-sets-rtl' : ''; ?> translation_set_id ) { $translation->translation_set_id = $translation_set->id; } $can_approve_translation = GP::$permission->current_user_can( 'approve', 'translation', $translation->id, array( 'translation' => $translation ) ); gp_tmpl_load( 'translation-row', get_defined_vars() ); } ?>
get_static( 'statuses' ) as $legend_status ) : ?>

slug, $translation_set->slug, 'import-translations' ) ), __( 'Import Translations', 'glotpress' ) ); } /** * The 'default' filter is 'Current/waiting/fuzzy + untranslated (All)', however that is not * the default action when exporting so make sure to set it on the export link if no filter * has been activated by the user. */ if ( ! array_key_exists( 'status', $filters ) ) { $filters['status'] = 'current_or_waiting_or_fuzzy_or_untranslated'; } $export_url = gp_url_project( $project, array( $locale->slug, $translation_set->slug, 'export-translations' ) ); $export_link = gp_link_get( $export_url, __( 'Export', 'glotpress' ), array( 'id' => 'export', 'filters' => add_query_arg( array( 'filters' => $filters ), $export_url ), ) ); $format_options = array(); foreach ( GP::$formats as $slug => $format ) { $format_options[ $slug ] = $format->name; } $what_dropdown = gp_select( 'what-to-export', array( 'all' => _x( 'all current', 'export choice', 'glotpress' ), 'filtered' => _x( 'only matching the filter', 'export choice', 'glotpress' ), ), 'all' ); $format_dropdown = gp_select( 'export-format', $format_options, 'po' ); /* translators: 1: export 2: what to export dropdown (all/filtered) 3: export format */ $footer_links[] = sprintf( __( '%1$s %2$s as %3$s', 'glotpress' ), $export_link, $what_dropdown, $format_dropdown ); /** * Filter footer links in translations. * * @since 1.0.0 * * @param array $footer_links Default links. * @param GP_Project $project The current project. * @param GP_Locale $locale The current locale. * @param GP_Translation_Set $translation_set The current translation set. */ $footer_links = apply_filters( 'gp_translations_footer_links', $footer_links, $project, $locale, $translation_set ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo implode( ' • ', $footer_links ); ?>