mirror of
https://github.com/WenPai-org/wp-china-yes.git
synced 2025-08-07 14:35:20 +08:00
refactor:若存在中文翻译文件,则在翻译语言选择界面不做停留直接跳转到中文翻译的编辑界面。若不存在则弹出提示并上报包信息给WP-China.org的翻译平台进行自动翻译
This commit is contained in:
parent
a09cfb90e0
commit
f4ccf1ff1d
1 changed files with 18 additions and 101 deletions
|
@ -4,105 +4,22 @@
|
|||
*/
|
||||
|
||||
/* @var Loco_mvc_ViewParams[] $pairs */
|
||||
if( $pairs ):?>
|
||||
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-sort-type="s">
|
||||
<?php esc_html_e('Language','loco-translate')?>
|
||||
</th>
|
||||
<th colspan="2" data-sort-type="n">
|
||||
<?php esc_html_e('Translation progress','loco-translate')?>
|
||||
</th>
|
||||
<th data-sort-type="n">
|
||||
<?php esc_html_e('Pending','loco-translate')?>
|
||||
</th>
|
||||
<th data-sort-type="s">
|
||||
<?php esc_html_e('File info','loco-translate')?>
|
||||
</th>
|
||||
<th data-sort-type="n">
|
||||
<?php esc_html_e('Last modified','loco-translate')?>
|
||||
</th>
|
||||
<th data-sort-type="s">
|
||||
<?php esc_html_e('Folder','loco-translate')?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php
|
||||
foreach( $pairs as $po ): $ispo = (bool) $po->lcode;?>
|
||||
<tr>
|
||||
<td class="has-row-actions" data-sort-value="<?php $po->e('lname')?>">
|
||||
<a href="<?php $po->e('edit')?>" class="row-title"><?php
|
||||
if( $ispo ):?>
|
||||
<span <?php echo $po->lattr?>><code><?php $po->e('lcode')?></code></span>
|
||||
<span><?php $po->e('lname')?></span><?php
|
||||
else:?>
|
||||
<span class="icon icon-file"></span>
|
||||
<span><?php esc_html_e('Template file','loco-translate')?></span><?php
|
||||
endif?>
|
||||
</a><?php
|
||||
if( $domain ):?>
|
||||
<nav class="row-actions">
|
||||
<span>
|
||||
<a href="<?php $po->e('edit')?>"><?php esc_html_e('Edit','loco-translate')?></a> |
|
||||
</span>
|
||||
<span>
|
||||
<a href="<?php $po->e('view')?>"><?php esc_html_e('View','loco-translate')?></a> |
|
||||
</span>
|
||||
<span>
|
||||
<a href="<?php $po->e('info')?>"><?php esc_html_e('Info','loco-translate')?></a> |
|
||||
</span>
|
||||
<span>
|
||||
<a href="<?php $po->e('copy')?>"><?php esc_html_e('Copy','loco-translate')?></a> |
|
||||
</span>
|
||||
<span class="trash">
|
||||
<a href="<?php $po->e('delete')?>"><?php esc_html_e('Delete','loco-translate')?></a>
|
||||
</span>
|
||||
</nav><?php
|
||||
endif?>
|
||||
</td><?php
|
||||
|
||||
if( $ispo ):?>
|
||||
<td data-sort-value="<?php echo $po->meta->getPercent()?>">
|
||||
<?php $po->meta->printProgress()?>
|
||||
</td>
|
||||
<td title="of <?php $po->n('total')?>">
|
||||
<?php echo $po->meta->getPercent()?>%
|
||||
</td>
|
||||
<td data-sort-value="<?php $po->f('todo','%u')?>">
|
||||
<?php $po->n('todo')?>
|
||||
</td><?php
|
||||
|
||||
else:?>
|
||||
<td data-sort-value="-1">
|
||||
-- <!-- no progress for template -->
|
||||
</td>
|
||||
<td>
|
||||
<!-- no percentage for template -->
|
||||
</td>
|
||||
<td data-sort-value="-1">
|
||||
-- <!-- no pendingfor template -->
|
||||
</td><?php
|
||||
endif?>
|
||||
|
||||
<td data-sort-value="<?php $po->e('name')?>">
|
||||
<a href="<?php $po->e('info')?>"><?php $po->e('name')?></a>
|
||||
</td>
|
||||
<td data-sort-value="<?php $po->f('time','%u')?>">
|
||||
<time datetime="<?php $po->date('time','c')?>"><?php $po->date('time')?></time>
|
||||
</td>
|
||||
<td>
|
||||
<?php $po->e('store')?>
|
||||
</td>
|
||||
</tr><?php
|
||||
endforeach;?>
|
||||
</tbody>
|
||||
</table><?php
|
||||
else:?>
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<tr>
|
||||
<td><?php self::e( __('No translations found for "%s"','loco-translate'), $domain )?></td>
|
||||
</tr>
|
||||
</table><?php
|
||||
if( $pairs ):
|
||||
foreach ($pairs as $po):
|
||||
if ($po->lcode == 'zh_CN'):
|
||||
?>
|
||||
<a id="edit-view-url" style="display: none;"><?php $po->e('edit');?></a>
|
||||
<script type="text/javascript">
|
||||
url = document.getElementById('edit-view-url').innerText;
|
||||
window.location.replace(url);
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
endforeach;
|
||||
endif;
|
||||
?>
|
||||
<!--
|
||||
TODO:这里应该包含上报包信息的逻辑
|
||||
-->
|
||||
该包未被<a href="https://translate.wp-china.org">https://translate.wp-china.org</a>翻译,当前已经上报,通常会在30分钟内推送汉化包
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue