first commit
This commit is contained in:
63
wp-content/plugins/loco-translate/tpl/admin/file/conf.php
Normal file
63
wp-content/plugins/loco-translate/tpl/admin/file/conf.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* PO file options form
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
/* @var Loco_gettext_SyncOptions $conf */
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
?>
|
||||
|
||||
<div class="panel">
|
||||
<h3>
|
||||
<?php esc_html_e('Template options','loco-translate')?>
|
||||
</h3>
|
||||
|
||||
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-main"><?php
|
||||
/* @var Loco_mvc_HiddenFields $hidden */
|
||||
$hidden->_e();?>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr valign="top" class="compact">
|
||||
<td>
|
||||
<label for="loco-conf-template"><?php esc_html_e('Relative path to template file','loco-translate');?>:</label><br />
|
||||
<input type="text" name="conf[template]" value="<?php self::e( (string) $conf->getTemplate() )?>" size="100" id="loco-conf-template" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="compact">
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input type="radio" name="conf[mode]" value="po" <?php echo $conf->mergeMsgstr()?'checked ':''?>/>
|
||||
<?php $params->f('potName', __('Copy target translations from "%s"','loco-translate') )?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input type="radio" name="conf[mode]" value="pot" <?php echo $conf->mergeMsgstr()?'':'checked '?>/>
|
||||
<?php esc_html_e('Just copy English source strings','loco-translate')?>
|
||||
</label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="compact">
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" name="conf[json]" value="1" <?php echo $conf->mergeJson()?'checked ':''?>/>
|
||||
<?php esc_html_e('Merge strings from related JSON files','loco-translate')?>
|
||||
</label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
<button type="submit" class="button button-primary" disabled><?php esc_html_e('Save','loco-translate')?></button>
|
||||
<a href="<?php $params->e('advanced')?>" class="button button-link"><?php esc_html_e('Advanced','loco-translate')?></a>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
36
wp-content/plugins/loco-translate/tpl/admin/file/delete.php
Normal file
36
wp-content/plugins/loco-translate/tpl/admin/file/delete.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Confirmation form for deleting a file
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
?>
|
||||
|
||||
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-del">
|
||||
<div class="panel panel-danger">
|
||||
<h3>
|
||||
<span class="has-icon icon-trash"> </span>
|
||||
<span><?php esc_html_e('Confirm delete','loco-translate')?></span>
|
||||
</h3>
|
||||
<p>
|
||||
<?php
|
||||
echo __('Are you sure you want to <strong>permanently</strong> delete the following file?','loco-translate')?>
|
||||
</p>
|
||||
<p>
|
||||
<code><?php $info->e('relpath')?></code>
|
||||
</p><?php
|
||||
if( $params->has('deps') ):?>
|
||||
<p>
|
||||
<strong><?php $params->e('warn')?></strong><?php
|
||||
foreach( $deps as $info ):?>
|
||||
<div><?php $info->e('name')?></div><?php
|
||||
endforeach?>
|
||||
</p><?php
|
||||
endif?>
|
||||
<p class="submit">
|
||||
<button type="submit" class="button button-danger" disabled><?php esc_html_e('Delete Permanently','loco-translate')?></button>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
/* @var Loco_mvc_HiddenFields $hidden */
|
||||
$hidden->_e();?>
|
||||
</form>
|
||||
45
wp-content/plugins/loco-translate/tpl/admin/file/diff.php
Normal file
45
wp-content/plugins/loco-translate/tpl/admin/file/diff.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* File revisions and rollback UI
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
$dfmt = _x( 'j M @ H:i', 'revision date short format', 'default' );
|
||||
/* @var Loco_mvc_ViewParams $master */
|
||||
?>
|
||||
|
||||
<div class="revisions loading" id="loco-ui">
|
||||
<form class="revisions-control-frame" action="" method="post" enctype="application/x-www-form-urlencoded">
|
||||
<div class="loco-clearfix">
|
||||
<div class="revisions-previous jshide">
|
||||
<button type="button" class="button" disabled><?php echo esc_attr_x('Previous','Button label for a previous revision','loco-translate'); ?></button>
|
||||
</div>
|
||||
<div class="revisions-next jshide">
|
||||
<button type="button" class="button" disabled><?php echo esc_attr_x('Next','Button label for a next revision','loco-translate');?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="revisions-meta loco-clearfix">
|
||||
<div class="diff-meta diff-right">
|
||||
<span>Current revision saved <?php $master->e('reltime')?></span><br />
|
||||
<time><?php $master->date('mtime',$dfmt)?></time><br />
|
||||
<button type="button" class="button disabled" disabled>Restore</button>
|
||||
</div><?php
|
||||
/* @var Loco_mvc_FileParams[] $files */
|
||||
foreach( $files as $i => $file ):?>
|
||||
<div class="diff-meta jshide">
|
||||
<span><?php $file->e('name')?></span><br />
|
||||
<time><?php $file->date('potime',$dfmt)?></time><br />
|
||||
<button type="submit" class="button button-primary" name="backup" value="<?php $file->e('relpath')?>"><?php esc_html_e('Restore','loco-translate')?></button>
|
||||
<button type="submit" class="button button-danger" name="delete" value="<?php $file->e('relpath')?>"><?php esc_html_e('Delete','loco-translate')?></button>
|
||||
</div><?php
|
||||
endforeach?>
|
||||
</div><?php
|
||||
/* @var Loco_mvc_HiddenFields $hidden */
|
||||
$hidden->_e();?>
|
||||
</form>
|
||||
<div class="revisions-diff-frame jsonly">
|
||||
<div class="revisions-diff">
|
||||
<div class="loading-indicator"><span class="spinner"></span></div>
|
||||
<div class="diff"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
39
wp-content/plugins/loco-translate/tpl/admin/file/edit-po.php
Normal file
39
wp-content/plugins/loco-translate/tpl/admin/file/edit-po.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* PO file editor
|
||||
*/
|
||||
$this->extend('editor');
|
||||
$this->start('header');
|
||||
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
?>
|
||||
|
||||
<form action="<?php $params->e('dlAction')?>" method="post" target="_blank" id="loco-download" class="aux wp-core-ui">
|
||||
<fieldset><?php
|
||||
|
||||
// first download button is a direct download of the current file (.po, .pot, and potentially .mo)
|
||||
/* @var Loco_mvc_ViewParams $ui */?>
|
||||
<button class="button button-link has-icon icon-download" data-loco="source" disabled title="<?php $ui->e('download')?> <?php $params->e('filetype')?>">
|
||||
<span><?php $params->e('filetype')?></span>
|
||||
</button><?php
|
||||
|
||||
// second button is language pack if zip is available and project is configured
|
||||
/* @var Loco_Locale $locale */
|
||||
/* @var Loco_mvc_HiddenFields $dlFields */
|
||||
if( $locale && class_exists('ZipArchive',false) && $dlFields->has('domain') ):?>
|
||||
<button class="button button-link has-icon icon-zip" data-loco="archive" disabled title="<?php $ui->e('download')?> Zip">
|
||||
<span>ZIP</span>
|
||||
</button><?php
|
||||
|
||||
// else legacy MO file
|
||||
elseif( $locale ):?>
|
||||
<button class="button button-link has-icon icon-download" data-loco="binary" disabled title="<?php $ui->e('download')?> MO">
|
||||
<span>MO</span>
|
||||
</button><?php
|
||||
endif?>
|
||||
</fieldset><?php
|
||||
|
||||
$dlFields->_e();?>
|
||||
</form><?php
|
||||
|
||||
echo $this->render('../common/inc-po-header');
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* POT file editor
|
||||
*/
|
||||
$this->extend('editor');
|
||||
$this->start('header');
|
||||
?>
|
||||
|
||||
<form action="<?php $params->e('dlAction')?>" method="post" target="_blank" id="loco-download" class="aux wp-core-ui">
|
||||
<fieldset>
|
||||
<button class="button button-link has-icon icon-download" data-loco="source" disabled title="<?php $ui->e('download')?>">
|
||||
<span>POT</span>
|
||||
</button>
|
||||
</fieldset>
|
||||
<?php
|
||||
$dlFields->_e();?>
|
||||
</form>
|
||||
|
||||
<h3 class="has-lang">
|
||||
<span><?php esc_html_e('Template file','loco-translate')?>:</span>
|
||||
<span class="loco-meta">
|
||||
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
|
||||
<span id="loco-po-modified"><?php $params->date('modified')?></span>
|
||||
–
|
||||
<span id="loco-po-status"></span>
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
|
||||
<div id="loco-auto" title="Error">
|
||||
<p>Template files cannot be translated</p>
|
||||
</div>
|
||||
67
wp-content/plugins/loco-translate/tpl/admin/file/editor.php
Normal file
67
wp-content/plugins/loco-translate/tpl/admin/file/editor.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Editor layout for PO and POT files
|
||||
*/
|
||||
|
||||
$this->extend('../layout');
|
||||
echo $header;
|
||||
|
||||
/* @var Loco_mvc_ViewParams $js */
|
||||
/* @var Loco_mvc_ViewParams $ui */
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
/* @var Loco_mvc_ViewParams $locale */
|
||||
/* @var Loco_mvc_HiddenFields $dlFields */
|
||||
?>
|
||||
|
||||
<div id="loco-editor">
|
||||
<nav class="wp-core-ui">
|
||||
<form action="#" id="loco-actions">
|
||||
<fieldset>
|
||||
<button class="button has-icon icon-save" data-loco="save" disabled>
|
||||
<span><?php $ui->e('save')?></span>
|
||||
</button>
|
||||
<button class="button has-icon icon-revert" data-loco="revert" disabled>
|
||||
<span><?php $ui->e('revert')?></span>
|
||||
</button>
|
||||
<button class="button has-icon icon-sync" data-loco="sync" disabled>
|
||||
<span><?php $ui->e('sync')?></span>
|
||||
</button>
|
||||
</fieldset><?php
|
||||
if( $locale ):?>
|
||||
<fieldset>
|
||||
<button class="button has-icon icon-ok" data-loco="lint" disabled>
|
||||
<span><?php $ui->e('lint')?></span>
|
||||
</button>
|
||||
<button class="button has-icon icon-robot" data-loco="auto" disabled>
|
||||
<span><?php $ui->e('auto')?></span>
|
||||
</button>
|
||||
</fieldset><?php
|
||||
else:?>
|
||||
<fieldset>
|
||||
<button class="button has-icon icon-add" data-loco="add" disabled>
|
||||
<span><?php $ui->e('add')?></span>
|
||||
</button>
|
||||
<button class="button has-icon icon-del" data-loco="del" disabled>
|
||||
<span><?php $ui->e('del')?></span>
|
||||
</button>
|
||||
</fieldset><?php
|
||||
endif?>
|
||||
<fieldset class="loco-clearable">
|
||||
<input type="text" maxlength="100" name="q" id="loco-search" placeholder="<?php $ui->e('filter')?>" autocomplete="off" disabled />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<button class="button has-icon only-icon icon-pilcrow" data-loco="invs" disabled title="<?php $ui->e('invs')?>">
|
||||
<span><?php $ui->e('invs')?></span>
|
||||
</button>
|
||||
<button class="button has-icon only-icon icon-code" data-loco="code" disabled title="<?php $ui->e('code')?>">
|
||||
<span><?php $ui->e('code')?></span>
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</nav>
|
||||
|
||||
<div id="loco-editor-inner" class="jsonly">
|
||||
<div class="loco-loading"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
39
wp-content/plugins/loco-translate/tpl/admin/file/head.php
Normal file
39
wp-content/plugins/loco-translate/tpl/admin/file/head.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* PO/POT headers form
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
?>
|
||||
|
||||
<div class="panel">
|
||||
<h3>
|
||||
<?php esc_html_e('Edit file headers','loco-translate');?>
|
||||
</h3>
|
||||
|
||||
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-main"><?php
|
||||
/* @var Loco_mvc_HiddenFields $hidden */
|
||||
$hidden->_e();?>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody><?php
|
||||
/* @var LocoPoHeaders $head */
|
||||
foreach( $head as $key => $value ): if( preg_match('/^[-A-Za-z]+$/',$key) ):?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="loco-header-<?php echo $key?>"><?php echo $key?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="headers[<?php echo $key?>]" value="<?php self::e($value) ?>" size="100" id="loco-header-<?php echo $key?>" />
|
||||
</td>
|
||||
</tr><?php
|
||||
endif; endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
<button type="submit" class="button button-primary" disabled><?php esc_html_e('Save','loco-translate')?></button>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
44
wp-content/plugins/loco-translate/tpl/admin/file/info-mo.php
Normal file
44
wp-content/plugins/loco-translate/tpl/admin/file/info-mo.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* File info for a binary MO where the PO file is missing
|
||||
*/
|
||||
$this->extend('info');
|
||||
$this->start('header');
|
||||
?>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<h3>
|
||||
<a href="<?php $locale->e('href')?>">
|
||||
<span class="<?php $locale->e('icon')?>" lang="<?php $locale->e('lang')?>"><code><?php $locale->e('code')?></code></span>
|
||||
<span><?php $locale->e('name')?></span>
|
||||
</a>
|
||||
<span>— <?php esc_html_e('compiled','loco-translate')?></span>
|
||||
</h3>
|
||||
<dl>
|
||||
<dt><?php self::e( __('File size','loco-translate') )?>:</dt>
|
||||
<dd><?php $file->e('size')?></dd>
|
||||
|
||||
<dt><?php esc_html_e('File modified','loco-translate')?>:</dt>
|
||||
<dd><?php $file->date('mtime')?></dd>
|
||||
|
||||
<dt><?php esc_html_e('Last translation','loco-translate')?>:</dt>
|
||||
<dd><?php $params->e('author')?> — <date><?php $params->date('potime')?></date></dd>
|
||||
|
||||
<dt><?php esc_html_e('Compiled translations','loco-translate')?>:</dt>
|
||||
<dd>
|
||||
<?php echo esc_html( $meta->getTotalSummary() )?>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if( ! $sibling->existent ):?>
|
||||
<div class="panel panel-warning">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e('PO file missing','loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php esc_html_e("We can't find the original PO file from which this was compiled",'loco-translate')?>.
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* File info for a file type we know nothing about
|
||||
*/
|
||||
$this->extend('info');
|
||||
$this->start('header');
|
||||
?>
|
||||
|
||||
<div class="panel panel-error">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e('Unexpected file type','loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php $params->e('error')?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
91
wp-content/plugins/loco-translate/tpl/admin/file/info-po.php
Normal file
91
wp-content/plugins/loco-translate/tpl/admin/file/info-po.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* File info for a translation source PO
|
||||
*/
|
||||
$this->extend('info');
|
||||
$this->start('header');
|
||||
/* @var Loco_mvc_FileParams $file */
|
||||
/* @var Loco_mvc_FileParams $locale */
|
||||
/* @var Loco_gettext_Metadata $meta */
|
||||
?>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<nav>
|
||||
<a class="icon only-icon icon-cog" title="Configure" href="<?php $file->e('configure')?>"><span>configure</span></a>
|
||||
<a class="icon only-icon icon-download" title="Download" href="<?php $file->e('download')?>"><span>download</span></a>
|
||||
</nav>
|
||||
<h3>
|
||||
<a href="<?php $locale->e('href')?>" class="has-lang">
|
||||
<span class="<?php $locale->e('icon')?>" lang="<?php $locale->e('lang')?>"><code><?php $locale->e('code')?></code></span>
|
||||
<span><?php $locale->e('name')?></span>
|
||||
</a>
|
||||
</h3>
|
||||
<dl>
|
||||
<dt><?php self::e( __('File size','loco-translate') )?>:</dt>
|
||||
<dd><?php $file->e('size')?></dd>
|
||||
|
||||
<dt><?php self::e( __('File modified','loco-translate') )?>:</dt>
|
||||
<dd><time><?php $file->date('mtime')?></time></dd>
|
||||
|
||||
<dt><?php self::e( __('Last translation','loco-translate') )?>:</dt>
|
||||
<dd><?php $params->e('author')?> — <date><?php $params->date('potime')?></date></dd>
|
||||
|
||||
<dt><?php self::e( __('Translation progress','loco-translate') )?>:</dt>
|
||||
<dd>
|
||||
<?php self::e( $meta->getProgressSummary() )?>
|
||||
</dd>
|
||||
<dd>
|
||||
<?php $meta->printProgress()?>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if( ! $sibling->existent ):?>
|
||||
<div class="panel panel-warning">
|
||||
<h3 class="has-icon">
|
||||
<?php self::e( __('Binary file missing','loco-translate') )?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php self::e( __("We can't find the binary MO file that belongs with these translations",'loco-translate') )?>.
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
|
||||
|
||||
if( $params->has('potfile') ):
|
||||
if( $potfile->synced ):?>
|
||||
<div class="panel panel-success">
|
||||
<h3 class="has-icon">
|
||||
<?php self::e( __('In sync with template','loco-translate') )?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php // Translators: Where %s is the name of a template file
|
||||
self::e( __('PO file has the same source strings as "%s"','loco-translate'), $potfile->name )?>.
|
||||
</p>
|
||||
</div><?php
|
||||
|
||||
else:?>
|
||||
<div class="panel panel-info">
|
||||
<h3 class="has-icon">
|
||||
<?php self::e( __('Out of sync with template','loco-translate') )?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php // Translators: Where %s is the name of a template file
|
||||
self::e( __('PO file has different source strings to "%s". Try running Sync before making any changes.','loco-translate'), $potfile->name )?>
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
|
||||
// only showing missing template warning when project was matched. Avoids confusion if something went wrong
|
||||
elseif( $params->has('project') ):?>
|
||||
<div class="panel panel-debug">
|
||||
<h3 class="has-icon">
|
||||
<?php self::e( __('Missing template','loco-translate') )?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php
|
||||
self::e( __('These translations are not linked to a POT file. Sync operations will extract strings directly from source code.','loco-translate') )?>
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* File info for a template file (POT)
|
||||
*/
|
||||
$this->extend('info');
|
||||
$this->start('header');
|
||||
/* @var Loco_mvc_FileParams $file */
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
/* @var Loco_gettext_Metadata $meta */
|
||||
/* @var int $words */
|
||||
?>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<nav>
|
||||
<a class="icon only-icon icon-download" title="Download" href="<?php $file->e('download')?>"><span>download</span></a>
|
||||
</nav>
|
||||
<h3>
|
||||
<?php esc_html_e('Template file','loco-translate')?>
|
||||
</h3>
|
||||
<dl>
|
||||
<dt><?php self::e( __('File size','loco-translate') )?>:</dt>
|
||||
<dd><?php $file->e('size')?></dd>
|
||||
|
||||
<dt><?php esc_html_e('File modified','loco-translate')?>:</dt>
|
||||
<dd><time><?php $file->date('mtime')?></time></dd>
|
||||
|
||||
<dt><?php esc_html_e('Last extracted','loco-translate')?>:</dt>
|
||||
<dd><time><?php $params->date('potime')?></time></dd>
|
||||
|
||||
<dt><?php echo esc_html_x('Source text','Editor','loco-translate')?>:</dt>
|
||||
<dd><?php echo esc_html( $meta->getTotalSummary() )?> <span>(<?php echo sprintf( _n('%s word','%s words', $words, 'loco-translate'), number_format_i18n($words) )?>)</span></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if( 'POT' !== $file->type && ! $params->isTemplate ):?>
|
||||
<div class="panel panel-debug">
|
||||
<h3 class="has-icon">
|
||||
Unconventional file name
|
||||
</h3>
|
||||
<p>
|
||||
Template files should have the extension ".pot".<br />
|
||||
If this is intended to be a translation file it should end with a language code.
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
127
wp-content/plugins/loco-translate/tpl/admin/file/info.php
Normal file
127
wp-content/plugins/loco-translate/tpl/admin/file/info.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* File information for any type of file. Extended by specific views for supported types
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
echo $header;
|
||||
/* @var Loco_mvc_FileParams $file */
|
||||
?>
|
||||
|
||||
<?php
|
||||
if( ! $file->existent ):?>
|
||||
<div class="panel panel-error">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e("File doesn't exist",'loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<code><?php $file->e('relpath')?></code>
|
||||
</p>
|
||||
</div><?php
|
||||
elseif( $file->writable ):?>
|
||||
<div class="panel panel-success">
|
||||
<h3 class="has-icon">
|
||||
<?php // Translators: Where %s is the type of file, e.g. "po"
|
||||
self::e( __('%s file is writeable','loco-translate'), $file->type )?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php esc_html_e('You can update these translations directly from the editor to the file system','loco-translate')?>.
|
||||
</p>
|
||||
<p>
|
||||
<code><?php $file->ls()?></code>
|
||||
</p>
|
||||
</div><?php
|
||||
else:?>
|
||||
<div class="panel panel-locked">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e('Write protected','loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php esc_html_e("This file can't be updated directly by the web server",'loco-translate')?>.
|
||||
</p>
|
||||
<p>
|
||||
<?php // Translators: Where %s is the name (or number) of an operating system user
|
||||
self::e( __("To make changes you'll have to connect to the remote file system, or make the file writeable by %s",'loco-translate'), $params->httpd )?>.
|
||||
</p>
|
||||
<p>
|
||||
<code><?php $file->ls()?></code>
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
|
||||
|
||||
if( ! $dir->existent ):?>
|
||||
<div class="panel panel-error">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e("Directory doesn't exist",'loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php // Translators: "either" meaning that the file itself can't exist without a containing directory
|
||||
esc_html_e("The containing directory for this file doesn't exist either",'loco-translate')?>.
|
||||
</p>
|
||||
<p>
|
||||
<code><?php $dir->e('relpath')?></code>
|
||||
</p>
|
||||
</div><?php
|
||||
|
||||
elseif( $dir->writable ):?>
|
||||
<div class="panel panel-success">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e('Directory is writeable','loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php // Translators: Where %s is the name (or number) of an operating system user
|
||||
self::e( __('The containing directory is writeable by %s, so you can add new files in the same location','loco-translate'), $params->httpd )?>.
|
||||
</p>
|
||||
<p>
|
||||
<code><?php $dir->ls()?></code>
|
||||
</p><?php
|
||||
if( ! $file->deletable ):?>
|
||||
<p>
|
||||
<span class="has-icon icon-warn"></span>
|
||||
<?php esc_html_e('Note that the file may not be deletable due to additional ownership permissions','loco-translate')?>.
|
||||
</p><?php
|
||||
endif;?>
|
||||
</div><?php
|
||||
|
||||
else:?>
|
||||
<div class="panel panel-locked">
|
||||
<h3 class="has-icon">
|
||||
<?php esc_html_e('Write protected','loco-translate')?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php esc_html_e("This directory can't be written to directly by the web server",'loco-translate')?>.
|
||||
</p>
|
||||
<p>
|
||||
<?php // Translators: Where %s is the name (or number) of an operating system user
|
||||
self::e( __("To create new files here you'll have to connect to the remote file system, or make the directory writeable by %s",'loco-translate'), $params->httpd )?>.
|
||||
</p>
|
||||
<p>
|
||||
<code><?php $dir->ls()?></code>
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
|
||||
if( $file->autoupdate ):?>
|
||||
<div class="panel panel-info">
|
||||
<h3 class="has-icon"><?php
|
||||
esc_html_e('WordPress updates','loco-translate')?>
|
||||
</h3>
|
||||
<p><?php
|
||||
esc_html_e("Files in this location can be modified or deleted by WordPress automatic updates",'loco-translate')?>.
|
||||
<a target="_blank" href="<?php
|
||||
echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/files-deleted') )?>"><?php
|
||||
esc_html_e("What's this?",'loco-translate');
|
||||
?></a>
|
||||
</p>
|
||||
</div><?php
|
||||
endif;
|
||||
|
||||
if( $params->has('debug') ):?>
|
||||
<div class="panel panel-debug">
|
||||
<h3 class="has-icon">Developer notes</h3>
|
||||
<div><?php
|
||||
foreach( $debug as $prop => $raw ):?>
|
||||
<p><?php $debug->e($prop)?></p><?php
|
||||
endforeach?>
|
||||
</div><?php
|
||||
endif;
|
||||
43
wp-content/plugins/loco-translate/tpl/admin/file/move-po.php
Normal file
43
wp-content/plugins/loco-translate/tpl/admin/file/move-po.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Confirmation form for moving localized files to a new location.
|
||||
*/
|
||||
$this->extend('move');
|
||||
$this->start('source');
|
||||
|
||||
/* @var Loco_mvc_ViewParams $current */
|
||||
/* @var Loco_mvc_ViewParams[] $locations */
|
||||
?>
|
||||
|
||||
<div class="panel">
|
||||
<h2>
|
||||
<?php self::e( __('Choose a new location for these translations','loco-translate') );?>
|
||||
</h2>
|
||||
<table class="form-table">
|
||||
<tbody class="loco-paths"><?php
|
||||
foreach( $locations as $typeId => $location ):?>
|
||||
<tr class="compact">
|
||||
<td>
|
||||
<p class="description"><?php $location->e('label')?>:</p>
|
||||
</td>
|
||||
<td><?php
|
||||
/* @var Loco_mvc_ViewParams $choice */
|
||||
foreach( $location['paths'] as $choice ):?>
|
||||
<p><?php
|
||||
if( $choice->active ):?>
|
||||
<label>
|
||||
<input type="radio" name="dest" value="" disabled checked /><?php
|
||||
else:?>
|
||||
<label>
|
||||
<input type="radio" name="dest" value="<?php $choice->e('path')?>" /><?php
|
||||
endif?>
|
||||
<code class="path"><?php $choice->e('path')?></code>
|
||||
</label>
|
||||
</p><?php
|
||||
endforeach?>
|
||||
</td>
|
||||
</tr><?php
|
||||
endforeach?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Confirmation form for moving file or group of files to an exact/custom location.
|
||||
* Use for moving POT file, but also moving PO siblings when locale or text domain is unknown
|
||||
*/
|
||||
$this->extend('move');
|
||||
$this->start('source');
|
||||
|
||||
/* @var Loco_mvc_FileParams $file */
|
||||
/* @var Loco_mvc_ViewParams $current */
|
||||
?>
|
||||
<div class="panel">
|
||||
<h2>
|
||||
<?php self::e( __('Enter a new location for this file','loco-translate') );?>
|
||||
</h2>
|
||||
<p>
|
||||
<input type="text" name="dest" value="<?php $file->e('relpath')?>" class="large-text" />
|
||||
</p>
|
||||
</div>
|
||||
31
wp-content/plugins/loco-translate/tpl/admin/file/move.php
Normal file
31
wp-content/plugins/loco-translate/tpl/admin/file/move.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Confirmation form for moving any file or group of file siblings.
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
?>
|
||||
|
||||
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-main"><?php
|
||||
/* @var Loco_mvc_HiddenFields $hidden */
|
||||
$hidden->_e();
|
||||
echo $source?>
|
||||
<div class="panel panel-info">
|
||||
<h2>
|
||||
<?php self::e( __('Confirm relocation','loco-translate') );?>
|
||||
</h2>
|
||||
<p>
|
||||
<?php self::e(_n('The following file will be moved/renamed to the new location:','The following files will be moved/renamed to the new location:',count($files),'loco-translate'));
|
||||
/* @var Loco_fs_File[] $files */
|
||||
foreach( $files as $file ):
|
||||
echo '<div>',$params->escape( $file->basename() ),'</div>';
|
||||
endforeach?>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<button type="submit" class="button button-primary" disabled><?php esc_html_e('Move files','loco-translate')?></button><?php
|
||||
if( $params->has('advanced') ):?>
|
||||
<a href="<?php $params->e('advanced')?>" class="button button-link"><?php esc_html_e('Advanced','loco-translate')?></a><?php
|
||||
endif?>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
58
wp-content/plugins/loco-translate/tpl/admin/file/msgcat.php
Normal file
58
wp-content/plugins/loco-translate/tpl/admin/file/msgcat.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
/* @var string[] $lines */
|
||||
|
||||
echo $this->render('../common/inc-table-filter');?>
|
||||
|
||||
<div class="panel loco-loading" id="loco-po">
|
||||
<ol class="msgcat"><?php
|
||||
foreach( $lines as $i => $line ):?>
|
||||
<li id="po-l<?php printf('%u',$i+1)?>"><?php
|
||||
// may be totally blank line
|
||||
if( '' === $line ){
|
||||
echo '<span class="po-none"></span>';
|
||||
continue;
|
||||
}
|
||||
// may be a comment line
|
||||
if( '#' === substr($line,0,1) ){
|
||||
// may be able to parse out references
|
||||
$symbol = (string) substr($line,1,1);
|
||||
if( '' !== $symbol ){
|
||||
$line = substr($line,2);
|
||||
if( ':' === $symbol ){
|
||||
echo '<span class="po-refs">#:',preg_replace('/\\S+:\d+/', '<a href="#\\0" class="po-text">\\0</a>', $params->escape($line) ),'</span>';
|
||||
}
|
||||
// parse out flags and formatting directives
|
||||
else if( ',' === $symbol ){
|
||||
echo '<span class="po-flags">#,<span class="po-text">',preg_replace('/[-a-z]+/', '<em>\\0</em>', $params->escape($line) ),'</span></span>';
|
||||
}
|
||||
// else treat as normal comment even if empty
|
||||
else {
|
||||
echo '<span class="po-comment">#',$symbol,'<span class="po-text">',$params->escape($line),'</span></span>';
|
||||
}
|
||||
}
|
||||
// else probably an empty comment
|
||||
else {
|
||||
echo '<span class="po-comment">',$params->escape($line),'</span>';
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// grab keyword if there is one before quoted string
|
||||
if( preg_match('/^(msg[_a-z0-9\\[\\]]+)(\\s+)/', $line, $r ) ){
|
||||
echo '<span class="po-word">',$params->escape($r[1]),'</span><span class="po-space">',$params->escape($r[2]),'</span>';
|
||||
$line = substr( $line, strlen($r[0]) );
|
||||
}
|
||||
// remainder of line (or whole line) should be a quoted string
|
||||
if( preg_match('/^"(.*)"\s*$/', $line, $r ) ){
|
||||
echo '<span class="po-string">"<span class="po-text">',$params->escape($r[1]),'</span>"</span>';
|
||||
continue;
|
||||
}
|
||||
|
||||
// else print whatever junk is left of line
|
||||
echo '<span class="po-junk">',$params->escape($line),'</span>';
|
||||
|
||||
?></li><?php
|
||||
endforeach?>
|
||||
</ol>
|
||||
</div>
|
||||
65
wp-content/plugins/loco-translate/tpl/admin/file/view-mo.php
Normal file
65
wp-content/plugins/loco-translate/tpl/admin/file/view-mo.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Binary MO hex view
|
||||
*/
|
||||
$this->extend('view');
|
||||
$this->start('source');
|
||||
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
/* @var string $bin */
|
||||
?>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<p>
|
||||
<?php esc_html_e('File is in binary MO format','loco-translate')?>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<pre><?php
|
||||
// crude hex dump
|
||||
// TODO make dynamic - flowing to width + clicking bytes highlights right-hand character ranges
|
||||
|
||||
$i = 0;
|
||||
$r = 0;
|
||||
$cols = 24;
|
||||
$line = [];
|
||||
$bytes = strlen($bin);
|
||||
// establish formatting of row offset, based on largest row number
|
||||
$rowfmt = sprintf( '%%0%uX | ', strlen( sprintf( '%02X', $cols * floor( $bytes / $cols ) ) ) );
|
||||
|
||||
for( $b = 0; $b < $bytes; $b++ ){
|
||||
$c = substr($bin,$b,1);
|
||||
$n = ord($c);
|
||||
// print byte offset
|
||||
if( ! $line ){
|
||||
printf( $rowfmt, $b );
|
||||
}
|
||||
// print actual byte
|
||||
printf('%02X ', $n );
|
||||
// add printable to line
|
||||
if( $n === 9 ){
|
||||
$line[] = ' '; // <- tab?
|
||||
}
|
||||
else if ( $n < 32 || $n > 126 ) {
|
||||
$line[] = '.'; // <- unprintable
|
||||
}
|
||||
else {
|
||||
$line[] = $params->escape($c); // <- printable
|
||||
}
|
||||
// wrap at cols, and print plain text
|
||||
if( ++$i === $cols ){
|
||||
echo ' ', implode('', $line ), "\n";
|
||||
$line = [];
|
||||
$i = 0;
|
||||
$r++;
|
||||
}
|
||||
}
|
||||
if( $line ){
|
||||
if( $r ){
|
||||
echo str_repeat( ' ', $cols - $i );
|
||||
}
|
||||
echo ' ', implode('', $line ), "\n";
|
||||
}
|
||||
?></pre>
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP source view
|
||||
*/
|
||||
$this->extend('view');
|
||||
$this->start('source');
|
||||
|
||||
/* @var Loco_mvc_ViewParams $params */
|
||||
/* @var string $phps */
|
||||
|
||||
echo $this->render('../common/inc-po-header');?>
|
||||
|
||||
|
||||
<div class="panel">
|
||||
<?php highlight_string($phps);?>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* PO source view
|
||||
*/
|
||||
$this->extend('view');
|
||||
$this->start('source');
|
||||
|
||||
echo $this->render('../common/inc-po-header');
|
||||
echo $this->render('msgcat');
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* POT source view
|
||||
*/
|
||||
$this->extend('view');
|
||||
$this->start('source');
|
||||
?>
|
||||
<h3 class="has-lang">
|
||||
<span><?php esc_html_e('Template file','loco-translate')?>:</span>
|
||||
<span class="loco-meta">
|
||||
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
|
||||
<span id="loco-po-modified"><?php $params->date('modified')?></span>
|
||||
–
|
||||
<span id="loco-po-status"><?php echo esc_html( $meta->getTotalSummary() )?></span>
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<?php
|
||||
echo $this->render('msgcat');
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Source view - displays file in raw form if possible
|
||||
*/
|
||||
$this->extend('../layout');
|
||||
echo $source;
|
||||
Reference in New Issue
Block a user