-
Notifications
You must be signed in to change notification settings - Fork 1
/
table.php
153 lines (148 loc) · 4.31 KB
/
table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
namespace Wporg\TranslationEvents\Templates\Translations;
use GP;
use Wporg\TranslationEvents\Event\Event;
/** @var Event $event */
?>
<div id="translations_<?php echo esc_attr( $translation_set->id ); ?>">
<div class="gp-heading">
<h3>
<?php
printf(
/* translators: 1: Project name. 2: Translation set name. */
esc_html__( 'Translation of %1$s: %2$s', 'glotpress' ),
wp_kses(
gp_link_get(
gp_url_project_locale( $project, $translation_set->locale, $translation_set->slug ),
esc_html(
gp_project_names_from_root( $project )
)
),
array(
'a' => array(
'href' => array(),
'title' => array(),
),
)
),
esc_html( $locale->name )
);
?>
</h3>
</div>
<div class="gp-table-actions top">
<?php
if ( $can_approve ) {
gp_translations_bulk_actions_toolbar( $bulk_action, $can_write, $translation_set, 'top' );
}
?>
</div>
<?php $class_rtl = 'rtl' === $locale->text_direction ? ' translation-sets-rtl' : ''; ?>
<?php
/**
* Fires before the translation table has been displayed.
*
* @since 4.0.0
*
* @param array $def_vars Variables defined in the template.
*/
do_action( 'gp_before_translation_table', get_defined_vars() );
?>
<table data-translation-set="<?php echo esc_attr( $translation_set->id ); ?>" class="<?php echo esc_attr( apply_filters( 'gp_translation_table_classes', 'gp-table translations ' . $class_rtl, get_defined_vars() ) ); ?>">
<thead>
<tr>
<?php
if ( $can_approve ) :
?>
<th class="gp-column-checkbox checkbox" scope="row"><input type="checkbox" /></th>
<?php
endif;
?>
<th class="gp-column-priority"><?php /* Translators: Priority */ esc_html_e( 'Prio', 'glotpress' ); ?></th>
<th class="gp-column-original"><?php esc_html_e( 'Original string', 'glotpress' ); ?></th>
<th class="gp-column-translation"><?php esc_html_e( 'Translation', 'glotpress' ); ?></th>
<th class="gp-column-actions">—</th>
</tr>
</thead>
<?php
foreach ( $translations as $translation ) {
if ( ! $translation->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() );
}
?>
<tr class="preview" style="display: none"></tr>
<?php
if ( ! $translations ) :
?>
<tr><td colspan="<?php echo $can_approve ? 5 : 4; ?>"><?php esc_html_e( 'No translations were found!', 'glotpress' ); ?></td></tr>
<?php
endif;
?>
</table>
<?php
/**
* Fires after the translation table has been displayed.
*
* @since 4.0.0
*
* @param array $def_vars Variables defined in the template.
*/
do_action( 'gp_after_translation_table', get_defined_vars() );
?>
<div class="gp-table-actions bottom">
<?php
if ( $can_approve ) {
gp_translations_bulk_actions_toolbar( $bulk_action, $can_write, $translation_set, 'bottom' );
}
?>
<div id="legend">
<div><strong><?php esc_html_e( 'Legend:', 'glotpress' ); ?></strong></div>
<?php
foreach ( GP::$translation->get_static( 'statuses' ) as $legend_status ) :
if ( ( 'changesrequested' === $legend_status ) && ( ! apply_filters( 'gp_enable_changesrequested_status', false ) ) ) { // todo: delete when we merge the gp-translation-helpers in GlotPress.
continue;
}
?>
<div class="box status-<?php echo esc_attr( $legend_status ); ?>"></div>
<div>
<?php
switch ( $legend_status ) {
case 'current':
esc_html_e( 'Current', 'glotpress' );
break;
case 'waiting':
esc_html_e( 'Waiting', 'glotpress' );
break;
case 'fuzzy':
esc_html_e( 'Fuzzy', 'glotpress' );
break;
case 'old':
esc_html_e( 'Old', 'glotpress' );
break;
case 'rejected':
esc_html_e( 'Rejected', 'glotpress' );
break;
case 'changesrequested':
if ( apply_filters( 'gp_enable_changesrequested_status', false ) ) { // todo: delete when we merge the gp-translation-helpers in GlotPress.
esc_html_e( 'Changes requested', 'glotpress' );
} else {
esc_html_e( 'Rejected', 'glotpress' );
}
break;
default:
echo esc_html( $legend_status );
}
?>
</div>
<?php
endforeach;
?>
<div class="box has-warnings"></div>
<div><?php esc_html_e( 'With warnings', 'glotpress' ); ?></div>
</div>
</div>
</div>
<hr>