feat:3.0.0版初次提交,新版将完全推倒重写

This commit is contained in:
sunxiyuan 2020-07-13 18:44:03 +08:00
parent e556c4b6d9
commit 39735249ee
293 changed files with 26908 additions and 475 deletions

View file

@ -0,0 +1,19 @@
<?php
/**
* Special case for viewing Hello Dolly plugin
* TODO implement package aliasing in a generic fashion as part of bundle configuration.
*/
$this->extend('../layout');
?>
<div class="notice inline notice-info">
<h3 class="has-icon">
<?php esc_attr_e('"Hello Dolly" is part of the WordPress core','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This plugin doesn't have its own translation files, but can be translated in the default text domain", 'loco-translate')?>.
</p>
<p>
<a href="<?php $params->e('redirect')?>"><?php esc_html_e('Go to WordPress Core','loco-translate')?></a>
</p>
</div>

View file

@ -0,0 +1,163 @@
<?php
/**
* Bundle configuration form
*/
$this->extend('../layout');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-conf"><?php
/* @var $p Loco_mvc_ViewParams */
foreach( $conf as $i => $p ): $id = sprintf('loco-conf-%u',$i)?>
<div id="<?php echo $id?>">
<a href="#" tabindex="-1" class="has-icon icon-del"><span class="screen-reader-text">remove</span></a>
<input type="hidden" name="<?php echo $p->prefix?>[removed]" value="" />
<?php
// display package name, and slug if it differs.
if( $p->name === $p->short ):?>
<h2><?php $p->e('name')?></h2><?php
else:?>
<h2><?php $p->e('name')?> <span>(<?php $p->e('short')?>)</span></h2><?php
endif;?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-name"><?php esc_html_e('Project name','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[name]" value="<?php $p->e('name')?>" id="<?php echo $id?>-name" class="regular-text" />
<p class="description">
<?php // Translators: Help tip for "Project name" field in advanced bundle config
esc_html_e('Descriptive name for this set of translatable strings','loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-domain"><?php esc_html_e('Text domain','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[domain]" value="<?php $p->e('domain')?>" id="<?php echo $id?>-domain" class="regular-text" />
<p class="description">
<?php // Translators: Help tip for "Text domain" field in advanced bundle config
esc_html_e('The namespace into which WordPress will load translated strings','loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-slug"><?php esc_html_e('File prefix','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[slug]" value="<?php $p->e('slug')?>" id="<?php echo $id?>-slug" class="regular-text" />
<p class="description">
<?php // Translators: Help tip for "File prefix" field in advanced bundle config
esc_html_e("Usually the same as the text domain, but don't leave blank unless you mean to",'loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-template"><?php esc_html_e('Template file','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[template][path]" id="<?php echo $id?>-template" class="regular-text" value="<?php echo $p->escape( $p->template['path'] )?>" />
<label>
<input type="checkbox" value="1" name="<?php echo $p->prefix?>[template][locked]" <?php empty($p->template['locked']) || print('checked');?> />
<?php esc_html_e('Locked','loco-translate')?>
</label>
<p class="description">
<?php // Translators: Help tip for "Template file" field in advanced bundle config
esc_html_e('Relative path from bundle root to the official POT file','loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-target"><?php esc_html_e('Domain path','loco-translate')?></label>
</th>
<td class="twin">
<div>
<span class="description"><?php esc_html_e('Include','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[target][path]" id="<?php echo $id?>-target" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->target['path'] )?></textarea>
</div>
<div>
<span class="description"><?php esc_html_e('Exclude','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[target][exclude][path]" id="<?php echo $id?>-xtarget" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->target['exclude']['path'] )?></textarea>
</div>
<p class="description">
<?php // Translators: Help tip for "Domain path" field in advanced bundle config
esc_html_e('Folders within the bundle that contain author-supplied translations','loco-translate')?>. (<?php esc_html_e('no wildcards','loco-translate')?>)
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-source"><?php esc_html_e('Source file paths','loco-translate')?></label>
</th>
<td class="twin">
<div>
<span class="description"><?php esc_html_e('Include','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[source][path]" id="<?php echo $id?>-source" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->source['path'] )?></textarea>
</div>
<div>
<span class="description"><?php esc_html_e('Exclude','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[source][exclude][path]" id="<?php echo $id?>-xsource" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->source['exclude']['path'] )?></textarea>
</div>
<p class="description">
<?php // Translators: Help tip for "Source file paths" field in advanced bundle config
esc_html_e('Files and folders within the bundle that contain localized PHP code','loco-translate')?>. (<?php esc_html_e('no wildcards','loco-translate')?>)
</p>
</td>
</tr>
</tbody>
</table>
</div><?php
endforeach;?>
<footer id="loco-form-foot">
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">
<label for="all-excl"><?php esc_html_e('Blocked paths','loco-translate')?>:</label>
</th>
<td>
<textarea name="exclude[path]" id="all-excl" rows="3" cols="30" class="large-text"><?php echo $params->escape($excl['path'])?></textarea>
<p class="description">
<?php // Translators: Help tip for "Blocked paths" field in advanced bundle config
esc_html_e('Folders within the bundle that will never be searched for files','loco-translate')?>. (<?php esc_html_e('no wildcards','loco-translate')?>)
</p>
</td>
</tr>
</tbody>
</table>
<p class="submit" >
<input type="submit" class="button-primary" value="<?php esc_html_e('Save config','loco-translate')?>" />
<button type="button" class="button" disabled id="loco-add-butt"><?php esc_html_e('Add set','loco-translate')?></button><?php
if( $params->parent ):?>
<a class="button button-link has-icon icon-cog" href="<?php $parent->e('href')?>"><?php esc_html_e('Parent theme','loco-translate')?></a><?php
endif?>
<a class="button button-link has-icon icon-download" href="<?php $params->e('xmlUrl')?>"><?php esc_html_e('XML','loco-translate')?></a>
</p>
</footer>
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<input type="hidden" name="name" value="<?php $params->e('name')?>" />
</form>
<?php if( 'db' === $saved ):?>
<form action="" method="post" id="loco-reset">
<p class="submit">
<input type="submit" name="unconf" class="button button-danger" value="<?php esc_html_e('Reset config','loco-translate')?>" />
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
</p>
</form><?php
endif;

View file

@ -0,0 +1,30 @@
<?php
/**
* Show bundle diagnostics
*/
$this->extend('../layout');
?>
<p>
<?php esc_html_e('This information is for developers to find problems in the bundle setup','loco-translate')?>.
</p>
<p data-vendor="<?php $meta->e('vendor')?>">
<?php echo $meta->author?>
</p>
<?php
/* @var $notice Loco_mvc_ViewParams */
foreach( $notices as $notice ):?>
<div class="<?php $notice->e('style')?>">
<p>
<strong class="has-icon"> </strong>
<?php $notice->e('body')?>
</p>
</div><?php
endforeach;
if( $params->has('xml') ):?>
<div class="notice inline notice-generic">
<h4>Current configuration as XML:</h4>
<pre><?php $params->e('xml')?></pre>
</div><?php
endif?>

View file

@ -0,0 +1,13 @@
<?php
/**
* Links above PO files table
*/
?>
<nav class="above-list-table"><?php
/* @var $link Loco_mvc_ViewParams */
foreach( $nav as $link ):?>
<a class="has-icon icon-<?php $link->e('icon')?>" href="<?php $link->e('href')?>"><?php $link->e('name')?></a><?php
endforeach;
echo $this->render('../common/inc-table-filter');
?>
</nav>

View file

@ -0,0 +1,108 @@
<?php
/**
* Table of localised file pairs in a project
*/
/* @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
endif;

View file

@ -0,0 +1,121 @@
<?php
/**
* Listing of all files within a locale, grouped by bundle
*/
$this->extend('../layout');
?>
<div class="notice inline notice-info">
<h3 class="has-lang">
<span <?php echo $locale->attr?>><code><?php $locale->e('code')?></code></span>
<span><?php $locale->e('name')?></span>
<span class="loco-meta">
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
<span><?php $params->date('modified')?></span>
</span>
</h3>
</div>
<?php
foreach( $translations as $t => $group ): $type = $types[$t];?>
<div class="loco-projects">
<h3>
<?php $type->e('name')?>
</h3><?php
echo $this->render('../common/inc-table-filter');
?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Bundle name','loco-translate')?>
</th><?php
if( $npofiles ):?>
<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><?php
endif?>
<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
/* @var Loco_mvc_ViewParams $po */
foreach( $group as $po ): ?>
<tr>
<td class="has-row-actions" data-sort-value="<?php $po->e('lname')?>">
<a href="<?php $po->e('edit')?>" class="row-title">
<?php $po->e('title')?>
</a>
<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>
</td><?php
if( $npofiles ):
if( 'PO' === $po->type ):?>
<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 pending for template -->
</td><?php
endif;
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','Y-m-d H:i:s')?>"><?php $po->date('time')?></time>
</td>
<td>
<?php $po->e('store')?>
</td>
</tr><?php
endforeach;?>
</tbody>
</table>
<p>
<a href="<?php $type->e('href')?>" class="button button-link has-raquo"><?php $type->e('text')?></a>
</p>
</div><?php
endforeach;

View file

@ -0,0 +1,20 @@
<?php
/**
* Bundle setup layout.
* See setup/*.php for header definitions
*/
$this->extend('../layout');
echo $header;
?>
<div class="notice inline notice-generic">
<h3 class="has-icon">
<?php esc_html_e('Author details','loco-translate')?>
</h3>
<p>
<?php esc_html_e('If you have trouble translating this bundle, consider asking the author for help','loco-translate')?>.
</p>
<p>
<?php echo $credit?>
</p>
</div>

View file

@ -0,0 +1,18 @@
<?php
/**
* Bundle is configured by official author
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="notice inline notice-success">
<h3 class="has-icon">
<?php esc_html_e('Official configuration','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration is provided by the author",'loco-translate')?>.
<?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View file

@ -0,0 +1,81 @@
<?php
/**
* "auto" config options
*/
$this->extend('../setup');
$this->start('header');
if( $params->has('jsonFields') ):?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" class="notice inline notice-generic jsonly" id="loco-remote">
<h3>
<?php esc_html_e('Check config repository','loco-translate')?>
</h3>
<fieldset id="loco-remote-query">
<p>
<?php esc_html_e("We have a database of non-standard bundle configurations.\nIf we know your bundle, we'll configure it for you automatically",'loco-translate')?>
</p>
<p>
<select name="vendor">
<option value="wordpress"><?php esc_html_e('WordPress','default')?></option>
</select>
<input type="text" name="slug" value="<?php $params->e('vendorSlug')?>" class="regular-text" />
</p>
</fieldset>
<div id="loco-remote-empty">
<p>
<button type="button" class="button button-primary"><?php esc_html_e('Find config','loco-translate')?></button>
<a href="<?php $tabs[1]->e('href')?>" class="button button-link"><?php esc_html_e('Cancel','default')?></a>
<span></span>
</p>
</div>
<div id="loco-remote-found" class="jshide">
<p>
<input type="submit" class="button button-success" name="json-setup" value="<?php esc_attr_e('OK, Load this config','loco-translate')?>" />
<input type="reset" class="button button-link" value="<?php esc_attr_e('Cancel','default')?>" />
</p>
</div>
<?php $jsonFields->_e()?>
</form><?php
endif;
if( $params->has('xmlFields') ):?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" class="notice inline notice-generic">
<h3>
<?php esc_html_e('XML setup','loco-translate')?>
</h3>
<p>
<?php esc_html_e("If you've been given a configuration file by a developer, paste the XML code here",'loco-translate')?>:
</p>
<fieldset>
<textarea name="xml-content" class="large-text" rows="3" wrap="virtual"></textarea>
</fieldset>
<p>
<input type="submit" class="button button-primary" name="xml-setup" value="<?php esc_html_e('Load config','loco-translate')?>" />
<a href="<?php $tabs[1]->e('href')?>" class="button button-link"><?php esc_html_e('Cancel','default')?></a>
</p>
<?php $xmlFields->_e()?>
</form><?php
endif;
if( $params->has('autoFields') ):?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" class="notice inline notice-generic">
<h3>
Auto setup
</h3>
<p>
We can make some guesses about how this bundle is set up, but we can't guarantee they'll be right.
</p>
<p>
This is not recommended unless you're a developer able to make manual changes afterwards.
</p>
<p>
<input type="submit" class="button button-primary" name="auto-setup" value="Guess config" />
</p>
<?php $autoFields->_e()?>
</form><?php
endif;

View file

@ -0,0 +1,20 @@
<?php
/**
* Bundle is set up internally
*/
$this->extend('../../layout');
?>
<div class="notice inline notice-success">
<h3 class="has-icon">
<?php esc_html_e('Bundle auto-configured','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration is built into Loco",'loco-translate')?>.
<?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco-translate')?>.
</p>
<p class="submit">
<a href="<?php $tabs[2]->e('href')?>" class="button button-link has-icon icon-wrench"><?php esc_html_e('Advanced configuration','loco-translate')?></a>
</p>
</div>

View file

@ -0,0 +1,26 @@
<?php
/**
* Common links below variable setup header.
*/
$help = esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/bundle-setup') );
if( $params->has('notices') ):?>
<ul class="problems"><?php
foreach( $params->notices as $text ):?>
<li class="has-icon icon-remove">
<?php echo $params->escape( $text )?>
</li><?php
endforeach?>
</ul><?php
endif?>
<p class="submit">
<a href="<?php $tabs[2]->e('href')?>" class="button button-link has-icon icon-wrench"><?php esc_html_e('Advanced configuration','loco-translate')?></a>
</p>
<p>
<a href="<?php $tabs[1]->e('href')?>&amp;xml=1" class="button button-link has-icon icon-upload"><?php esc_html_e('Import config from XML','loco-translate')?></a>
</p>
<p>
<a href="<?php echo $help?>" class="button button-link has-icon icon-help" target="_blank"><?php esc_html_e('Get help with this','loco-translate')?></a>
</p>

View file

@ -0,0 +1,18 @@
<?php
/**
* Bundle is set up fully from self-declared metadata
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="notice inline notice-success">
<h3 class="has-icon">
<?php esc_html_e('Bundle auto-configured','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration has been automatically detected and seems to be fully compatible",'loco-translate')?>.
<?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View file

@ -0,0 +1,18 @@
<?php
/**
* Bundle is not set up at all
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php esc_html_e('Unconfigured bundle','loco-translate')?>
</h3>
<p>
<?php esc_html_e('This bundle isn\'t set up for translation in a way we understand','loco-translate')?>.
<?php esc_html_e('It needs configuring before you can do any translations','loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View file

@ -0,0 +1,18 @@
<?php
/**
* Bundle is set up from self-declared metadata, but has some missing bits
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="notice inline notice-warning">
<h3 class="has-icon icon-info">
<?php esc_html_e('Partially configured bundle','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration has been automatically detected, but isn't fully complete",'loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View file

@ -0,0 +1,23 @@
<?php
/**
* Bundle is saved in database, but can be reset
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="notice inline notice-info">
<h3 class="has-icon">
<?php esc_html_e('Bundle configuration saved','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration is saved in the WordPress database",'loco-translate')?>.
</p>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<p class="submit">
<input type="submit" name="reset-setup" class="button button-danger" value="<?php esc_html_e('Reset config','loco-translate')?>" />
<a href="<?php $tabs[2]->e('href')?>" class="button button-link has-icon icon-wrench"><?php esc_html_e('Edit config','loco-translate')?></a>
</p>
<?php $reset->_e()?>
</form>
</div>

View file

@ -0,0 +1,68 @@
<?php
/**
* Bundle overview
*/
$this->extend('../layout');
/* @var Loco_mvc_ViewParams[] $projects */
/* @var Loco_mvc_ViewParams[] $unknown */
if( $projects ):
foreach( $projects as $p ): ?>
<div class="loco-project" id="loco-<?php $p->e('id')?>"><?php
// display package name, and slug if it differs.
if( $p->name === $p->short ):?>
<h2><?php $p->e('name')?></h2><?php
else:?>
<h2><?php $p->e('name')?> <span>(<?php $p->e('short')?>)</span></h2><?php
endif;
echo $this->render('inc-po-links', array( 'nav' => $p->nav ) );
echo $this->render('inc-po-table', array( 'pairs' => $p->po, 'domain' => $p->domain ) );
?>
</div><?php
endforeach;
if( $unknown ):?>
<div class="loco-project">
<div class="notice inline notice-info">
<h2><?php esc_html_e('Additional files found','loco-translate')?></h2>
<p>
<?php
esc_html_e("This bundle isn't fully configured, so we don't know what the following files are for",'loco-translate')?>. <?php
// Translators: %s is a URL. Keep the <a> tag intact
echo wp_kses(
sprintf( __('Click the <a href="%s">setup</a> tab to complete the bundle configuration','loco-translate'), $tabs[1]->href ),
array('a'=>array('href'=>true)), array('http','https')
);?>.
</p>
</div>
<?php
echo $this->render('../common/inc-table-filter');
echo $this->render('inc-po-table', array( 'pairs' => $unknown, 'domain' => null ) )?>
</div><?php
endif;
// showing incompatibility message if no configured projects available
else:?>
<div class="loco-project">
<div class="notice inline notice-error">
<h2><?php $params->e('name')?> <span>(<?php esc_html_e('unconfigured','loco-translate')?>)</span></h2>
<p>
<?php
esc_html_e("This bundle isn't automatically compatible and requires configuring before you can use all the functions of Loco Translate",'loco-translate')?>. <?php
echo wp_kses(
sprintf( __('Click the <a href="%s">setup</a> tab to complete the bundle configuration','loco-translate'), $tabs[1]->href ),
array('a'=>array('href'=>true)), array('http','https')
);?>.
</p>
</div>
</div><?php
if( $unknown ):?>
<div class="loco-project">
<?php echo $this->render('inc-po-table', array( 'pairs' => $unknown, 'domain' => null ) )?>
</div><?php
endif;
endif;

View file

@ -0,0 +1,65 @@
<?php
/**
* Include standard file system connect dialog
*/
$help = esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/filesystem') );
// Total file lock prevents any kind of update, regardless of connection
if( $params->has('fsLocked') ):?>
<div class="has-nav notice inline notice-locked">
<p>
<strong class="has-icon"><?php esc_html_e('Locked','loco-translate')?>:</strong>
<span><?php $params->e('fsLocked')?>.</span>
</p>
<nav>
<a href="<?php echo $help?>#wp" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>#loco--fs-protect"><?php esc_html_e('Settings','loco-translate')?></a>
</nav>
</div><?php
// else specific file may be protected from updates by the bundle config
elseif( $params->has('fsDenied') ):?>
<div class="has-nav notice inline notice-locked">
<p>
<strong class="has-icon"><?php esc_html_e('Read only','loco-translate')?>:</strong>
<span><?php esc_html_e('File is protected by the bundle configuration','loco-translate')?>.</span>
</p>
</div><?php
// else render remote connection form
else:?>
<div id="loco-fs-warn" class="has-nav notice inline notice-info jshide">
<p>
<strong class="has-icon"><?php esc_html_e('Notice','loco-translate')?>:</strong>
<span class="loco-msg"><!-- warning to be loaded by ajax --></span>
</p>
<nav>
<a href="<?php echo $help?>#wp" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>#loco--fs-protect"><?php esc_html_e('Settings','loco-translate')?></a>
</nav>
</div>
<form id="loco-fs" class="has-nav notice inline notice-locked jshide jsonly">
<p>
<strong class="has-icon"><?php
// Translators: When a file or folder cannot be modified due to filesystem permissions
esc_html_e('Write protected','loco-translate')?>:
</strong>
<span class="loco-msg">
<!-- specific reason to be loaded by ajax -->
</span>
<span><?php
esc_html_e('Click "Connect" to authenticate with the server','loco-translate')?>.
</span>
</p>
<nav>
<button type="button" class="button button-small button-primary"><?php esc_html_e('Connect','loco-translate')?></button>
<a class="button button-small" href="<?php echo $help?>#remote" target="_blank"> ? </a>
</nav><?php
$fsFields->_e();?>
</form><?php
endif;

View file

@ -0,0 +1,13 @@
<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>
<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>
&ndash;
<span id="loco-po-status"><?php $params->has('meta') && self::e( $meta->getProgressSummary() )?></span>
</span>
</h3>

View file

@ -0,0 +1,8 @@
<form class="loco-filter" action="#">
<fieldset class="loco-clearable">
<input type="text" name="q" value="" autocomplete="off" placeholder="<?php
// translators: text field placeholder
esc_html_e('Filter...','loco-translate')?>" size="20" />
</fieldset>
</form>

View file

@ -0,0 +1,102 @@
<?php
/**
* API keys/settings screen
*/
$this->extend('../layout');
/* @var Loco_mvc_ViewParams[] $apis */
/* @var Loco_mvc_ViewParams $nonce */
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/providers');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<table class="form-table">
<tbody><?php
// GOOGLE
$api = $apis['google']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e(__('API key','loco-translate'))?></span>
</legend>
<p>
<label for="loco--google_api_key">
<?php esc_html_e(__('API key','loco-translate'))?>:
</label>
<input type="text" size="50" name="api[google][key]" id="loco--google_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<span class="description"><a href="https://cloud.google.com/translate/" target="_blank" tabindex="-1">https://cloud.google.com/translate</a></span>
</p>
</fieldset>
</td>
</tr><?php
// MICROSOFT
$api = $apis['microsoft']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e(__('API key','loco-translate'))?></span>
</legend>
<p>
<label for="loco--microsoft_api_key">
<?php esc_html_e(__('API key','loco-translate'))?>:
</label>
<input type="text" size="50" name="api[microsoft][key]" id="loco--microsoft_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<label for="loco--microsoft_api_region">
<?php esc_html_e(__('API region','loco-translate'))?>:
</label>
<input type="text" size="20" name="api[microsoft][region]" id="loco--microsoft_api_region" value="<?php $api->e('region')?>" spellcheck="false" placeholder="global" />
</p>
<p>
<span class="description"><a href="https://aka.ms/MicrosoftTranslator" target="_blank" tabindex="-1">https://aka.ms/MicrosoftTranslator</a></span>
</p>
</fieldset>
</td>
</tr><?php
// YANDEX
$api = $apis['yandex']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e(__('API key','loco-translate'))?></span>
</legend>
<p>
<label for="loco--yandex_api_key">
<?php esc_html_e(__('API key','loco-translate'))?>:
</label>
<input type="text" size="90" name="api[yandex][key]" id="loco--yandex_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<span class="description"><a href="https://tech.yandex.com/translate/" target="_blank" tabindex="-1">https://tech.yandex.com/translate/</a></span>
</p>
</fieldset>
</td>
</tr>
</tbody>
</table>
<div class="notice inline">
<p>
<strong class="has-icon"><?php esc_html_e('Important','loco-translate')?>:</strong>
<span>
<?php esc_html_e('Third party services are subject to their own terms of use and may incur costs from the provider','loco-translate')?>.
<a href="<?php self::e($help)?>#legal" target="_blank" tabindex="-1"><?php esc_html_e('See full disclaimer','loco-translate')?></a>.
</span>
</p>
</div>
<p class="submit">
<input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" />
<a class="button button-link" href="<?php self::e($help)?>" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
</p>
</form>

View file

@ -0,0 +1,123 @@
<?php
/**
* System diagnostics
*/
$this->extend('../layout');
?>
<div class="panel" id="loco-versions">
<h3>
Versions
<a href="#loco-versions" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
foreach( $versions as $key => $value ): if( $value ):?>
<dt>
<?php echo $versions->escape($key)?>:
</dt>
<dd>
<code class="path"><?php $versions->e($key)?></code>
</dd><?php
endif; endforeach?>
</dl>
</div>
<div class="panel" id="loco-unicode">
<h3>
Unicode
<a href="#loco-unicode" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl>
<dt>UTF-8 rendering:</dt>
<dd><?php echo $encoding->OK?> <span id="loco-utf8-check"><?php echo $encoding->tick?></span></dd>
<dt>Multibyte support:</dt>
<dd><?php echo $encoding->mbstring?></dd>
</dl>
</div>
<div class="panel" id="loco-ajax">
<h3>
Ajax
<a href="#loco-ajax" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl>
<dt>Endpoint:</dt>
<dd><code id="loco-ajax-url" class="path">/wp-admin/admin-ajax.php</code></dd>
<dt>JSON decoding:</dt>
<dd><?php echo $encoding->json?></dd>
<dt class="jsonly">Ajax test result:</dt>
<dd class="jsonly" id="loco-ajax-check"><span class="inline-spinner"> </span></dd>
</dl>
</div>
<div class="panel" id="loco-apis">
<h3>
Translation APIs
<a href="#loco-apis" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
/* @var Loco_mvc_ViewParams[] $apis */
foreach( $apis as $api ):?>
<dt><?php $api->e('name')?>:</dt>
<dd class="jsonly" id="loco-api-<?php $api->e('id')?>"><span class="inline-spinner"> </span></dd><?php
endforeach?>
</dl>
</div>
<div class="panel" id="loco-sizes">
<h3>
Limits
<a href="#loco-sizes" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
foreach( $memory as $key => $value ):?>
<dt>
<?php echo $memory->escape($key)?>:
</dt>
<dd>
<?php $memory->e($key)?>
</dd><?php
endforeach?>
</dl>
</div>
<div class="panel" id="loco-files">
<h3>
Filesystem
<a href="#loco-files" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl>
<dt>Custom languages directory:</dt>
<dd><code class="path"><?php $fs->e('langdir')?></code></dd>
<dt>Directory writable:</dt>
<dd><?php echo $fs->writable?'Yes':'No'?></dd>
<dt>File mods disallowed:</dt>
<dd><?php echo $fs->disabled?'Yes':'No'?></dd>
<dt>File mod safety level:</dt>
<dd><?php $fs->e('fs_protect')?></dd>
</dl>
</div>
<div class="panel" id="loco-debug">
<h3>
Debug settings
<a href="#loco-debug" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
foreach( $debug as $key => $value ):?>
<dt>
<?php echo $debug->escape($key)?>:
</dt>
<dd>
<?php $debug->e($key)?>
</dd><?php
endforeach?>
</dl>
</div>

View file

@ -0,0 +1,34 @@
<?php
/**
* User preferences screen
*/
$this->extend('../layout');
/* @var Loco_data_Preferences $opts */
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php esc_html_e('Translator credit','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Translator credit','loco-translate')?></span>
</legend>
<p>
<input type="text" size="64" name="opts[credit]" id="loco--credit" value="<?php echo esc_attr($opts->credit)?>" placeholder="<?php echo esc_attr($opts->default_credit())?>" />
</p>
</fieldset>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" />
<a class="button button-link" href="<?php self::e($help)?>#user" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
</p>
</form>

View file

@ -0,0 +1,179 @@
<?php
/**
* Global settings screen. (plugin options)
*/
$this->extend('../layout');
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings');
$fs_help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/filesystem');
/* @var Loco_data_Settings $opts */
/* @var Loco_data_Settings $dflt */
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php esc_html_e('Compiling MO files','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Compiling MO files','loco-translate')?></span>
</legend>
<p>
<label for="loco--gen-hash">
<input type="checkbox" name="opts[gen_hash]" value="1" id="loco--gen-hash"<?php echo $opts->gen_hash?' checked':''?> />
<?php esc_html_e('Generate hash tables','loco-translate')?>
</label>
</p>
<p>
<label for="loco--use-fuzzy">
<input type="checkbox" name="opts[use_fuzzy]" value="1" id="loco--use-fuzzy"<?php echo $opts->use_fuzzy?' checked':''?> />
<?php esc_html_e('Include Fuzzy strings','loco-translate')?>
</label>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e('Extracting strings','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Extracting strings','loco-translate')?></span>
</legend>
<p>
<label for="loco--max_php_size">
<?php esc_html_e('Skip PHP files larger than:','loco-translate')?>
</label>
<input type="text" size="5" name="opts[max_php_size]" id="loco--max_php_size" value="<?php echo esc_attr( $opts->max_php_size)?>" placeholder="<?php echo esc_attr($dflt->max_php_size)?>" />
</p>
<p>
<label for="loco--php_alias">
<?php esc_html_e('Scan PHP files with extensions:','loco-translate')?>
</label>
<input type="text" size="15" name="opts[php_alias]" id="loco--php_alias" value="<?php echo esc_attr( implode(' ',$opts->php_alias) )?>" placeholder="<?php echo esc_attr(implode(' ',$dflt->php_alias))?>" />
</p>
<p>
<label for="loco--jsx_alias">
<?php esc_html_e('Scan JavaScript files with extensions:','loco-translate')?>
</label>
<input type="text" size="15" name="opts[jsx_alias]" id="loco--jsx_alias" value="<?php echo esc_attr( implode(' ',$opts->jsx_alias) )?>" placeholder="<?php echo esc_attr(implode(' ',$dflt->jsx_alias))?>" />
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e('Saving PO/POT files','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Saving PO/POT files','loco-translate')?></span>
</legend>
<p>
<label for="loco--num-backups">
<?php esc_html_e('Number of backups to keep of each file:','loco-translate')?>
</label>
<input type="number" min="0" max="99" size="2" name="opts[num_backups]" id="loco--num_backups" value="<?php printf('%u',$opts->num_backups)?>" />
</p>
<p>
<label for="loco--po-width">
<?php esc_html_e('Maximum line length (zero disables wrapping)','loco-translate')?>
</label>
<input type="number" min="0" max="999" size="2" name="opts[po_width]" id="loco--po-width" value="<?php printf('%u',$opts->po_width)?>" />
</p>
<p>
<label for="loco--po-utf8-bom">
<input type="checkbox" name="opts[po_utf8_bom]" value="1" id="loco--po-utf8-bom"<?php echo $opts->po_utf8_bom?' checked':''?> />
<?php esc_html_e('Add UTF-8 byte order mark','loco-translate')?> (<?php esc_html_e('Not recommended','loco-translate')?>)
</label>
</p>
<p>
<label for="loco--ajax-files">
<input type="checkbox" name="opts[ajax_files]" value="1" id="loco--ajax-files"<?php echo $opts->ajax_files?' checked':''?> />
<?php esc_html_e('Enable Ajax file uploads','loco-translate')?> (<?php esc_html_e('Recommended','loco-translate')?>)
</label>
</p>
</fieldset>
</td>
</tr>
<!--tr>
<th scope="row"><?php esc_html_e('POT template files','loco-translate')?></th>
<td>
<fieldset>
<p>
<label for="loco--pot_alias">
< ?php esc_html_e('Look for non-standard names:','loco-translate')? >
</label>
<input type="text" size="40" name="opts[pot_alias]" id="loco--pot_alias" value="< ?php echo esc_attr( implode(' ',$opts->pot_alias) )? >" />
</p>
</fieldset>
</td>
</tr-->
<tr>
<th scope="row"><?php esc_html_e('File system access','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('File system access','loco-translate')?></span>
</legend>
<p>
<label for="loco--fs-persist">
<input type="checkbox" name="opts[fs_persist]" value="1" id="loco--fs-persist"<?php echo $opts->fs_persist?' checked':''?> />
<?php esc_html_e('Save credentials in session','loco-translate')?>
(<?php esc_html_e('Not recommended','loco-translate')?>)
</label>
</p>
<p><?php
/* @var Loco_mvc_ViewParams $verbose */
esc_html_e('Modification of installed files','loco-translate');?>:
<select name="opts[fs_protect]" id="loco--fs-protect">
<option value="0"><?php $verbose->e(0)?></option>
<option value="1"<?php echo 1 === $opts->fs_protect?' selected':''?>><?php $verbose->e(1)?></option>
<option value="2"<?php echo 2 === $opts->fs_protect?' selected':''?>><?php $verbose->e(2)?></option>
</select>
</p>
<p><?php
esc_html_e('Editing of POT (template) files','loco-translate');?>:
<select name="opts[pot_protect]" id="loco--pot-protect">
<option value="0"><?php $verbose->e(0)?></option>
<option value="1"<?php echo 1 === $opts->pot_protect?' selected':''?>><?php $verbose->e(1)?></option>
<option value="2"<?php echo 2 === $opts->pot_protect?' selected':''?>><?php $verbose->e(2)?></option>
</select>
</p>
<p>
<span class="description">
<a href="<?php self::e($fs_help)?>" target="_blank"><?php
esc_html_e('About file system access','loco-translate')?></a>
</span>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e('Grant access to roles','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Allow full access to these roles','loco-translate')?></span>
</legend><?php
/* @var Loco_mvc_ViewParams[] $caps */
foreach( $caps as $cap ):?>
<p>
<label>
<input type="checkbox" name="<?php $cap->e('name')?>" value="<?php $cap->e('label')?>" <?php echo $cap->attrs?> />
<?php $cap->e('label')?>
</label>
</p><?php
endforeach;?>
</fieldset>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" />
<a class="button button-link" href="<?php self::e($help)?>" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
</p>
</form>

View file

@ -0,0 +1,41 @@
<?php
/**
* Plugin version information
*/
$this->extend('../layout');
if( $params->has('update') ):?>
<div class="notice inline notice-warning">
<h3 class="has-icon">
<?php self::e( __('Version %s','loco-translate'), $version )?>
</h3>
<p>
<?php esc_html_e( __('A newer version of Loco Translate is available for download','loco-translate') )?>.
</p>
<p class="submit">
<a class="button button-primary" href="<?php echo $update_href?>"><?php self::e(__('Upgrade to %s','loco-translate'), $update )?></a>
<a class="button button-link has-icon icon-ext" href="https://wordpress.org/plugins/loco-translate/installation/" target="_blank"><?php esc_html_e( __('Install manually','loco-translate') )?></a>
</p>
</div><?php
elseif( $params->has('devel') ):?>
<div class="notice inline notice-debug">
<h3 class="has-icon">
<?php self::e( __('Version %s','loco-translate'), $version )?>
</h3>
<p>
<?php esc_html_e("You're running a development snapshot of Loco Translate",'loco-translate')?>
</p>
</div><?php
else:?>
<div class="notice inline notice-success">
<h3 class="has-icon">
<?php self::e( __('Version %s','loco-translate'), $version)?>
</h3>
<p>
<?php esc_html_e("You're running the latest version of Loco Translate",'loco-translate')?>
</p>
</div><?php
endif;

View file

@ -0,0 +1,16 @@
<?php
/**
* Debug
*/
$this->extend('layout');
?>
<h1>Debug</h1>
<?php
echo $this->render('../debug/dump');
?>
<form>
<button class="button button-primary button-large has-icon icon-save loco-loading" disabled>Test spinner</button>
</form>

View file

@ -0,0 +1,19 @@
<?php
/**
* File is actually a directory
*/
$this->extend('../layout');
?>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php esc_html_e('File is a directory','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This page was expecting a file, but the path is actually a directory",'loco-translate')?>:
</p>
<p>
<code><?php $info->e('relpath')?></code>
</p>
</div>

View file

@ -0,0 +1,19 @@
<?php
/**
* File path not found
*/
$this->extend('../layout');
?>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php esc_html_e('File not found','loco-translate')?>
</h3>
<p>
<?php esc_html_e("Either this file is missing or the server doesn't have permission to access it",'loco-translate')?>:
</p>
<p>
<code class="path"><?php $params->e('path')?></code>
</p>
</div>

View file

@ -0,0 +1,17 @@
<?php
/**
* File security issue
*/
$this->extend('../layout');
?>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php esc_html_e('File access disallowed','loco-translate')?>
</h3>
<p>
<?php esc_html_e("Access to this file is blocked for security reasons",'loco-translate')?>:
<strong><?php $params->e('reason')?></strong>
</p>
</div>

View file

@ -0,0 +1,35 @@
<?php
/*
* Generic admin page error template
*/
$this->extend('../layout');
/* @var Loco_mvc_View $this */
/* @var Loco_error_Exception $error */
?>
<h1><?php echo esc_html( $error->getTitle() )?></h1>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php self::e( $error->getMessage() )?>
</h3><?php
/* @var Loco_mvc_FileParams $file */
if( $params->has('file') && $file->line ):?>
<p>
<code class="path"><?php $file->e('relpath')?>#<?php $file->e('line')?></code>
</p><?php
endif?>
</div>
<?php
/* @var Loco_mvc_ViewParams[] $trace */
if( $this->has('trace') ):
echo "<!-- DEBUG:\n";
foreach( $trace as $f ):
echo ' ',($f->has('class')?$f['class'].'::':''), $f->e('function'),' ', $f->e('file'),':',$f->e('line'), "\n";
endforeach;
echo " -->\n";
endif;

View file

@ -0,0 +1,26 @@
<?php
/**
* Information page when a file has no backups.
*/
$this->extend('../layout');
$help = esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings') );
?>
<div class="notice inline notice-warning">
<h3><?php
esc_html_e('No previous file revisions','loco-translate')?>
</h3>
<p><?php
if( $enabled ):
esc_html_e('Backup files will be written when you save translations from Loco Translate editor','loco-translate');
else:
esc_html_e('File backups are disabled in your plugin settings','loco-translate');
endif?>.
</p>
<p class="submit">
<a href="<?php echo $help?>#po" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>"><?php esc_html_e('Settings','loco-translate')?></a>
</p>
</div>

View file

@ -0,0 +1,17 @@
<?php
/*
* Full screen error when there are no installed files for a given locale
*/
$this->extend('../layout');
?>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php esc_html_e('No files found for this language','loco-translate')?>
</h3>
<p>
It may not be installed properly.
See <a href="https://codex.wordpress.org/Installing_WordPress_in_Your_Language">Installing WordPress in your language</a>.
</p>
</div>

View file

@ -0,0 +1,29 @@
<?php
/**
* Tokenizer extension required.
* Warning should also appear in the usual notices location. This page is just for information.
*/
$this->extend('../layout');
?>
<div class="notice inline notice-info">
<h3 class="has-icon">
<?php esc_html_e('About the Tokenizer','loco-translate')?>
</h3>
<p>
<?php
// Translators: change "en" in the URL to your language if it's available at http://php.net/docs.php
echo wp_kses(
__('Loco requires the <a href="http://php.net/manual/en/book.tokenizer.php" target="_blank">Tokenizer extension</a> to scan PHP source code for translatable strings','loco-translate'),
array('a'=>array('href'=>true,'target'=>true)), array('http','https')
);?>.
</p>
<p><?php
// Translators: %s is a URL. Keep the <a> tag intact
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
echo wp_kses(
sprintf( __('You can still translate any bundle that has a <a href="%s" target="_blank">template</a>','loco-translate'), $help ),
array('a'=>array('href'=>true,'target'=>true)), array('https')
);?>.
</p>
</div>

View 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="notice inline notice-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','default')?></button>
</p>
</div>
<?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
</form>

View file

@ -0,0 +1,85 @@
<?php
/**
* File revisions and rollback UI
*/
$this->extend('../layout');
$dfmt = _x( 'j M @ H:i', 'revision date short format', 'default' );
?>
<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' ); ?></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' ); ?></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 $file Loco_mvc_FileParams */
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 $hidden Loco_mvc_HiddenFields */
$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>
<?php /*
<!--hr />
<h3>Advanced</h3>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<table class="wp-list-table widefat striped">
<thead>
<tr>
<th>
<?php esc_html_e('Revision saved','loco-translate')?>
</th>
<th>
<?php esc_html_e('File info','loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
foreach( $files as $i => $file ):?>
<tr>
<td>
<label>
<input type="radio" name="backup" value="<?php $file->e('relpath')?>" />
<?php $file->date('mtime')?>
</label>
</td>
<td><code class="path"><?php $file->ls()?></code></td>
</tr><?php
endforeach?>
</tbody>
</table>
<p class="submit">
<button type="submit" class="button button-danger"><?php esc_html_e('Restore selected','default')?></button>
</p>
<?php
$hidden->_e();?>
</form-->
*/

View file

@ -0,0 +1,69 @@
<?php
/**
* PO file editor
*/
$this->extend('editor');
$this->start('header');
echo $this->render('../common/inc-po-header');
/* @var Loco_mvc_ViewParams $js */
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/providers');
// inline modal for auto-translate. Note that modal will be placed outside of #loco.wrap element
if( $js->apis ):?>
<div id="loco-auto" class="loco-batch" title="<?php esc_html_e('Auto-translate this file','loco-translate');?>">
<form action="#">
<fieldset>
<select name="api" id="auto-api"><?php foreach( $js->apis as $api ):?>
<option value="<?php self::e($api['id'])?>"><?php self::e($api['name'])?></option><?php
endforeach?>
</select>
</fieldset>
<fieldset>
<p>
<label for="auto-existing">
<input type="checkbox" id="auto-existing" name="existing" />
<?php esc_html_e('Overwrite existing translations','loco-translate')?>
</label>
</p>
<p>
<label for="auto-fuzzy">
<input type="checkbox" id="auto-fuzzy" name="fuzzy" />
<?php esc_html_e('Mark new translations as Fuzzy','loco-translate')?>
</label>
</p>
<blockquote id="loco-job-progress">
Initializing...
</blockquote>
<p>
<button type="submit" class="button button-primary has-icon icon-translate">
<span><?php esc_html_e('Translate','loco-translate')?></span>
</button>
<a href="<?php self::e($help)?>" class="button button-link has-icon icon-help" target="_blank"><?php
esc_html_e('Help','loco-translate');
?></a>
</p>
</fieldset>
</form>
</div><?php
// inline modal for when no APIs are configured.
else:?>
<div id="loco-auto" class="loco-alert" title="<?php esc_html_e('No translation APIs configured','loco-translate');?>">
<p>
<?php esc_html_e('Add automatic translation services in the plugin settings.','loco-translate')?>
</p>
<nav>
<a href="<?php $this->route('config-apis')->e('href')?>" class="has-icon icon-cog"><?php
esc_html_e('Settings','loco-translate');
?></a>
<a href="<?php self::e($help)?>" class="has-icon icon-help" target="_blank"><?php
esc_html_e('Help','loco-translate');
?></a>
</nav>
</div><?php
endif;

View file

@ -0,0 +1,22 @@
<?php
/**
* POT file editor
*/
$this->extend('editor');
$this->start('header');
?>
<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>
&ndash;
<span id="loco-po-status"></span>
</span>
</h3>
<div id="loco-auto" title="Error">
<p>Template files cannot be translated</p>
</div>

View file

@ -0,0 +1,76 @@
<?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_HiddenFields $dlFields */
?>
<div id="loco-editor">
<nav id="loco-toolbar" 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-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>
<form action="<?php $params->e('dlAction')?>" method="post" target="_blank" id="loco-download" class="aux">
<fieldset>
<button class="button button-link has-icon icon-download" data-loco="source" disabled title="<?php $ui->e('download')?>">
<span><?php $params->e('filetype')?></span>
</button>
<button class="button button-link has-icon icon-download" data-loco="binary" disabled title="<?php $ui->e('download')?> MO">
<span>MO</span>
</button>
</fieldset>
<?php
$dlFields->_e();?>
</form>
</nav>
<div id="loco-editor-inner" class="jsonly">
<div class="loco-loading"></div>
</div>
</div>

View 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="notice inline notice-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>&mdash; <?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')?> &mdash; <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="notice inline notice-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;

View file

@ -0,0 +1,17 @@
<?php
/**
* File info for a file type we know nothing about
*/
$this->extend('info');
$this->start('header');
?>
<div class="notice inline notice-error">
<h3 class="has-icon">
<?php esc_html_e('Unexpected file type','loco-translate')?>
</h3>
<p>
<?php $params->e('error')?>
</p>
</div>

View file

@ -0,0 +1,86 @@
<?php
/**
* File info for a translation source PO
*/
$this->extend('info');
$this->start('header');
/* @var Loco_mvc_FileParams $file */
/* @var Loco_gettext_Metadata $meta */
?>
<div class="notice inline notice-info">
<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')?> &mdash; <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="notice inline notice-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="notice inline notice-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="notice inline notice-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="notice inline notice-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;

View file

@ -0,0 +1,39 @@
<?php
/**
* File info for a template file (POT)
*/
$this->extend('info');
$this->start('header');
/* @var Loco_mvc_FileParams $file */
/* @var Loco_gettext_Metadata $meta */
?>
<div class="notice inline notice-info">
<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('1 word','%s words', $words, 'loco-translate'), number_format_i18n($words) )?>)</span></dd>
</dl>
</div>
<?php
if( 'POT' !== $file->type && ! $params->isTemplate ):?>
<div class="notice inline notice-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;

View file

@ -0,0 +1,127 @@
<?php
/**
* File information for ony type of file. Extended by specific views for supported types
*/
$this->extend('../layout');
echo $header;
?>
<?php
if( ! $file->existent ):?>
<div class="notice inline notice-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="notice inline notice-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="notice inline notice-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="notice inline notice-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="notice inline notice-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="notice inline notice-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="notice inline notice-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="notice inline notice-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;

View 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="notice inline notice-generic">
<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_FileParams $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>

View file

@ -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="notice inline notice-generic">
<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>

View 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-move"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();
echo $source?>
<div class="notice inline notice-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>

View file

@ -0,0 +1,55 @@
<?php
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">&quot;<span class="po-text">',$params->escape($r[1]),'</span>&quot;</span>';
continue;
}
// else print whatever junk is left of line
echo '<span class="po-junk">',$params->escape($line),'</span>';
?></li><?php
endforeach?>
</ol>
</div>

View file

@ -0,0 +1,62 @@
<?php
/**
* Binary MO hex view
*/
$this->extend('view');
$this->start('source');
?>
<div class="notice inline notice-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 = array();
$bytes = strlen($bin);
// establish formatting of row offset, nbased 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 = array();
$i = 0;
$r++;
}
}
if( $line ){
if( $r ){
echo str_repeat( ' ', $cols - $i );
}
echo ' ', implode('', $line ), "\n";
}
?></pre>
</div>

View file

@ -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');

View file

@ -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>
&ndash;
<span id="loco-po-status"><?php echo esc_html( $meta->getTotalSummary() )?></span>
</span>
</h3>
<?php
echo $this->render('msgcat');

View file

@ -0,0 +1,6 @@
<?php
/**
* Source view - displays file in raw form if possible
*/
$this->extend('../layout');
echo $source;

View file

@ -0,0 +1,13 @@
<?php
/**
* Help tab side bar, more information links
*/
?><p>
<strong><?php esc_html_e('For more information:','default')?></strong>
</p>
<p>
<a href="<?php echo esc_url( apply_filters('loco_external','https://wordpress.org/plugins/loco-translate/') )?>" target="_blank"><?php esc_html_e('Official plugin page','loco-translate')?></a>
</p>
<p>
<a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin') )?>" target="_blank"><?php esc_html_e('Help and tutorials','loco-translate')?></a>
</p>

View file

@ -0,0 +1,12 @@
<h2>
Advanced configuration
</h2>
<p>
The Advanced tab provides full, manual configuration of the bundle.
</p>
<p>
This screen is designed for bundle developers, if you don't know what to enter try asking the author.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/bundle-config'))?>" target="_blank">Full documentation</a>
</p>

View file

@ -0,0 +1,15 @@
<h2>
Bundle setup
</h2>
<p>
The Setup tab shows a summary of whether the bundle is configured for translation and where the configuration is stored.
</p>
<p>
See our help pages for how to set up unconfigured bundles.</p>
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/bundle-setup'))?>" target="_blank">Full documentation</a>
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/authors'))?>" target="_blank">Help for bundle authors</a>
</p>

View file

@ -0,0 +1,9 @@
<h2>
Bundle overview
</h2>
<p>
The Overview tab lists each set of available translations in the current bundle.
</p>
<p>
If Loco Translate can't configure your bundle automatically, click the Setup tab to see your options.
</p>

View file

@ -0,0 +1,10 @@
<h2>
<?php esc_html_e('API keys','loco-translate')?>
</h2>
<p>
Loco Translate supports integration with several third party machine translation services.
Each of these requires an account with the service provider and an API key for enabling access via the Loco Translate editor.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/providers'))?>" target="_blank"><?php esc_html_e('Full documentation','loco-translate')?></a>
</p>

View file

@ -0,0 +1,10 @@
<h2>
<?php esc_html_e('Plugin settings','loco-translate')?>
</h2>
<p>
<?php esc_html_e('Site options apply to all users of Loco Translate across the current site','loco-translate')?>.
<?php esc_html_e('User options apply to your WordPress login, across all sites','loco-translate')?>.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings'))?>" target="_blank"><?php esc_html_e('Full documentation','loco-translate')?></a>
</p>

View file

@ -0,0 +1,9 @@
<h2>
The translation editor
</h2>
<p>
This editor allows you to translate and save strings to your server's file system in the correct file format.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/editor'))?>" target="_blank">Full documentation</a>
</p>

View file

@ -0,0 +1,10 @@
<h2>
File information
</h2>
<p>
This screen shows technical information about the selected file.
You may find it useful in debugging problems
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/filesystem'))?>" target="_blank">About filesystem access</a>
</p>

View file

@ -0,0 +1,8 @@
<h2>
Source view
</h2>
<p>
This screen shows translation files in their <strong>raw</strong> form.
It's read-only because the file syntax is very easy to get wrong.
Click the "Editor" tab to make changes safely.
</p>

View file

@ -0,0 +1,7 @@
<h2>
Loco Translate home screen
</h2>
<p>
From the home screen you can access recently used items and your active theme.
To translate other themes, plugins, or the WordPress core, use the subsection links in the side menu.
</p>

View file

@ -0,0 +1,13 @@
<h2>
Adding a new language
</h2>
<p>
This screen is for adding new translation files on your server's file system.
</p>
<p>
The location you choose is important. Some file locations can be overwritten by WordPress updates.
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/files-deleted'))?>" target="_blank">See FAQ</a>
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/msginit'))?>" target="_blank">Full documentation</a>
</p>

View file

@ -0,0 +1,12 @@
<h2>
Creating a template
</h2>
<p>
This screen is for adding a new translations template for a set of translatable strings.
</p>
<p>
Your language files use this template to ensure they all reference the same strings.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates'))?>" target="_blank">Full documentation</a>
</p>

View file

@ -0,0 +1,10 @@
<h2>
Bundle listings
</h2>
<p>
This screen lists all bundles of the current type installed in your WordPress.
They may not all be ready for translation, but compatible bundles will show at least one "set" of translatable strings.
</p>
<p>
Clicking a bundle takes you to its translation management screen.
</p>

View file

@ -0,0 +1,10 @@
<h2>
Installed languages
</h2>
<p>
This screen lists all the languages that are installed in your WordPress.
For a language to show up here, you must have the WordPress core translation files installed.
</p>
<p>
Clicking a language takes you to its translation management screen.
</p>

View file

@ -0,0 +1,10 @@
<h2>
Installed language files
</h2>
<p>
This screen lists all files installed for the selected language.
</p>
<p>
Only files from correctly configured bundles will show up here.
If you don't see the files you expect, then locate the bundle in the Themes or Plugins section and ensure it's configured correctly.
</p>

View file

@ -0,0 +1,20 @@
<?php
/**
* Common "Help & support" help tab
*/
?><h2>
<?php esc_html_e('Getting help with Loco Translate','loco-translate')?>
</h2>
<p>
If you have problems using Loco Translate, please try our
<a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin') )?>" target="_blank">help pages</a>.
There's a lot of information there to help you understand how it works and the most common pitfalls to avoid.
</p>
<p>
To report a bug please start a new topic in the
<a href="https://wordpress.org/support/plugin/loco-translate" target="_blank">plugin support forum</a>,
but please check the <a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs') )?>">FAQs</a>
for similar issues first. If you decide to submit a bug report please post enough
<a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/debug-info') )?>">relevant detail</a>
for us to reproduce your issue.
</p>

View file

@ -0,0 +1,178 @@
<?php
/**
* Initialize a new PO translations file
*/
$this->extend('../layout');
// warn if doing direct extraction
/* @var Loco_mvc_ViewParams $ext */
if( $params->has('ext') ):?>
<div class="notice inline notice-info">
<p>
<?php esc_html_e("You're creating translations directly from source code",'loco-translate')?>.
<a href="<?php $ext->e('link')?>"><?php esc_html_e('Create template instead','loco-translate')?></a>.
</p>
</div><?php
endif;
/*/ warning to show/hide when locations are marked unsafe
if( $params->has('fsNotice') ):?>
<div id="loco-fs-info" class="has-nav notice inline notice-info jshide">
<p>
<strong class="has-icon"><?php esc_html_e('Warning','loco-translate')?>:</strong>
<span><?php $params->e('fsNotice')?>.</span>
</p>
<nav>
<a href="<?php echo $help?>#locations" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>#loco--fs-protect"><?php esc_html_e('Settings','loco-translate')?></a>
</nav>
</div><?php
endif*/?>
<div class="notice inline notice-generic">
<h2><?php $params->e('subhead')?></h2>
<p><?php $params->e('summary')?></p>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-poinit"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
<table class="form-table">
<tbody class="loco-locales">
<tr valign="top">
<th scope="row">
<label for="loco-select-locale">
1. <?php esc_html_e('Choose a language','loco-translate')?>:
</label>
</th>
<td>
<fieldset>
<label for="loco-use-selector-1">
<span><input type="radio" name="use-selector" value="1" checked id="loco-use-selector-1" /></span>
<?php esc_attr_e('WordPress language','loco-translate')?>:
</label>
<div>
<span class="lang nolang"></span>
<select id="loco-select-locale" name="select-locale">
<option value=""><?php esc_attr_e('No language selected','loco-translate')?></option>
<optgroup label="<?php esc_attr_e( 'Installed languages', 'loco-translate' )?>"><?php
/* @var Loco_mvc_ViewParams[] $installed */
foreach( $installed as $option ):?>
<option value="<?php $option->e('value')?>" data-icon="<?php $option->e('icon')?>"><?php $option->e('label')?></option><?php
endforeach;?>
</optgroup>
<optgroup label="<?php esc_attr_e( 'Available languages', 'loco-translate' )?>"><?php
/* @var Loco_mvc_ViewParams[] $locales */
foreach( $locales as $option ):?>
<option value="<?php $option->e('value')?>" data-icon="<?php $option->e('icon')?>"><?php $option->e('label')?></option><?php
endforeach;?>
</optgroup>
</select>
</div>
</fieldset>
<fieldset class="disabled">
<label for="loco-user-selector-0">
<span><input type="radio" name="use-selector" value="0" /></span>
<?php esc_attr_e('Custom language','loco-translate')?>:
</label>
<div>
<span class="lang nolang"></span>
<span class="loco-clearable"><input type="text" maxlength="14" name="custom-locale" value="" /></span>
</div>
</fieldset>
</td>
</tr>
</tbody>
<tbody class="loco-paths">
<tr valign="top">
<th scope="row">
<label>
2. <?php esc_html_e('Choose a location','loco-translate')?>:
</label>
</th>
<td>
<a href="<?php $help->e('href')?>#locations" class="has-icon icon-help" target="_blank" tabindex="-1"><?php $help->e('text')?></a>
</td>
</tr><?php
$choiceId = 0;
/* @var Loco_mvc_ViewParams[] $locations */
foreach( $locations as $typeId => $location ):?>
<tr class="compact">
<td>
<p class="description"><?php $location->e('label')?>:</p>
</td>
<td><?php
/* @var Loco_mvc_FileParams $choice */
/* @var Loco_mvc_FileParams $parent */
foreach( $location['paths'] as $choice ):
$parent = $choice['parent'];
$offset = sprintf('%u',++$choiceId);?>
<p><?php
if( $choice->disabled ):?>
<label class="for-disabled">
<span class="icon icon-lock"></span>
<input type="radio" name="select-path" class="disabled" disabled /><?php
else:?>
<label>
<input type="radio" name="select-path" value="<?php echo $offset?>" <?php echo $choice->checked?> />
<input type="hidden" name="path[<?php echo $offset?>]" value="<?php $choice->e('hidden')?>" /><?php
endif?>
<code class="path"><?php $parent->e('relpath')?>/<?php echo $choice->holder?></code>
</label>
</p><?php
endforeach?>
</td>
</tr><?php
endforeach;?>
</tbody><?php
if( $params->has('sourceLocale') ):?>
<tbody>
<tr valign="top">
<th scope="row" rowspan="3">
3. <?php esc_html_e('Template options','loco-translate')?>:
</th>
<td>
<a href="<?php $help->e('href')?>#copy" class="has-icon icon-help" target="_blank" tabindex="-1"><?php $help->e('text')?></a>
</td>
</tr>
<tr valign="top" class="compact">
<td>
<p>
<label>
<input type="radio" name="strip" value="" />
<?php $params->f('sourceLocale', __('Copy target translations from "%s"','loco-translate') )?>
</label>
</p>
<p>
<label>
<input type="radio" name="strip" value="1" 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="link" value="1" />
<?php esc_html_e('Use this file as template when running Sync','loco-translate')?>
</label>
</p>
</td>
</tr>
</tbody><?php
endif?>
</table>
<p class="submit">
<button type="submit" class="button button-large button-primary" disabled><?php esc_html_e('Start translating','loco-translate')?></button>
</p>
</form>
</div>

View file

@ -0,0 +1,46 @@
<?php
/**
* Initialize a new POT template file
*/
$this->extend('../layout');
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
?>
<div class="notice inline notice-generic">
<h2><?php $params->e('subhead')?></h2>
<p>
<?php esc_html_e('Source files to scan:','loco-translate')?>
<strong><?php $scan->n('count')?></strong>
<span>(<?php
// Translators: Where %s is the size of a file
$scan->f( 'size', __('%s on disk','loco-translate') );?>, <?php
// Translators: Where %s is the size of a file
$scan->f( 'largest', __('largest is %s','loco-translate') )?>)</span>
</p><?php
if( $n = $scan->skip ):?>
<p>
<em><?php
// Translators: Where %2$s is the size of a file
self::e( _n('Excludes one file over %2$s','Excludes %s files over %2$s',$n,'loco-translate'), $n, $scan->large )?>.
<a class="icon icon-help" href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/skipped-files'))?>" target="_blank"><span class="screen-reader-text">Help</span></a>
</em>
</p><?php
endif?>
<p>
<?php esc_html_e('Strings will be extracted to:','loco-translate')?>
<code class="path"><?php $pot->e('relpath')?></code>
</p>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-potinit"><?php
foreach( $hidden as $name => $value ):?>
<input type="hidden" name="<?php echo $name?>" value="<?php $hidden->e($name)?>" /><?php
endforeach;?>
<p class="submit">
<button type="submit" class="button button-large button-primary" disabled><?php esc_html_e('Create template','loco-translate')?></button>
<a href="<?php echo esc_url($help)?>" class="button button-large button-link" target="_blank"><?php
esc_html_e('About templates','loco-translate')?></a>
</p>
</form>
</div>

View file

@ -0,0 +1,42 @@
<?php
/**
* Notice before creating a PO that there is no POT
*/
$this->extend('../layout');
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
?>
<div class="notice inline notice-warning">
<h3 class="has-icon">
<?php esc_html_e('Template missing','loco-translate')?>
</h3><?php
if( $params->has('pot') ):?>
<p>
<?php esc_html_e("This bundle's template file doesn't exist yet. We recommend you create it before adding languages",'loco-translate')?>.
</p><?php
else:?>
<p>
<?php esc_html_e("This bundle doesn't define a translations template file",'loco-translate')?>.
</p><?php
endif?>
<p>
<a href="<?php $ext->e('link')?>" class="button button-link has-icon icon-add"><?php $ext->e('text')?></a>
<a href="<?php $skip->e('link')?>" class="button button-link has-icon icon-next"><?php $skip->e('text')?></a><?php
if( $this->has('conf') ):?>
<a href="<?php $conf->e('link')?>" class="button button-link has-icon icon-wrench"><?php $conf->e('text')?></a><?php
endif?>
<a class="button button-link has-icon icon-help" href="<?php echo esc_url($help)?>" target="_blank"><?php esc_html_e('About templates','loco-translate')?></a>
</p>
</div><?php
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/template-missing');
?>
<div class="notice inline notice-info">
<h3 class="has-icon"><?php esc_html_e('Suggestion','loco-translate')?></h3>
<p>
<?php esc_html_e('You can use existing translations as a template using the Copy feature.','loco-translate')?>
</p>
<p>
<a class="button button-link has-icon icon-back" href="<?php $tabs[0]->e('href')?>"><?php esc_html_e('Back','default')?></a>
<a class="button button-link has-icon icon-help" href="<?php echo esc_url($help)?>" target="_blank"><?php esc_html_e('See FAQ','loco-translate')?></a>
</p>
</div>

View file

@ -0,0 +1,78 @@
<?php
/**
* Base layout for all admin pages
*/
?><div class="wrap" id="loco"><?php
if( $this->has('breadcrumb') ):?>
<h1>
<ul><?php
/* @var Loco_mvc_ViewParams[] $breadcrumb */
foreach( $breadcrumb as $item ):?>
<li><?php
if( $item->href ):?>
<a href="<?php $item->e('href')?>">
<?php $item->e('name')?>
</a><?php
else:?>
<span>
<?php $item->e('name')?>
</span><?php
endif?>
</li><?php
endforeach?>
</ul>
</h1><?php
elseif( $this->has('title') ):?>
<h1>
<?php $params->e('title')?>
</h1><?php
endif;
if( $this->has('tabs') ):?>
<h2 class="nav-tab-wrapper"><?php
/* @var Loco_mvc_ViewParams[] $tabs */
foreach( $tabs as $item ):?>
<a href="<?php $item->e('href')?>" class="nav-tab<?php echo $item->active?' nav-tab-active':''?>">
<?php $item->e('name')?>
</a><?php
endforeach;?>
</h2><?php
endif?>
<div id="loco-notices">
<noscript>
<div class="notice inline notice-danger">
<p>
<strong class="has-icon icon-warn">JavaScript disabled:</strong>
<span>Loco Translate requires JavaScript for most functions to work as expected.</span>
</p>
</div>
</noscript><?php
// flush message buffer
do_action('loco_admin_notices');
// standard file system dialogues
if( $params->has('fsFields') ):
echo $this->render('common/inc-fsconn');
endif;?>
</div>
<div id="loco-content">
<?php echo $this->_content;?>
</div>
</div>
<?php
/* @var Loco_mvc_ViewParams $js */
if( $this->has('js') ):?>
<script>
/*<![CDATA[*/
window.locoConf = <?php echo $js->exportJson()?>;
/*]]>*/
</script><?php
endif;

View file

@ -0,0 +1,8 @@
<?php
/**
* Generic listing of bundles of a given type
*/
$this->extend('../layout');
echo $this->render('../common/inc-table-filter');
echo $this->render('inc-table');

View file

@ -0,0 +1,43 @@
<?php
/**
* List of bundles
*/
?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Bundle name', 'loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Text domain','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Last modified','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Sets','loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
/* @var $bundle Loco_pages_ViewParams */
foreach( $bundles as $bundle ):?>
<tr id="loco-<?php $bundle->e('id')?>">
<td data-sort-value="<?php $bundle->e('name')?>">
<a href="<?php $bundle->e('view')?>"><?php $bundle->e('name')?></a>
</td>
<td>
<?php $bundle->e('dflt')?>
</td>
<td data-sort-value="<?php $bundle->f('time','%u')?>">
<time datetime="<?php $bundle->date('time','c')?>"><?php $bundle->time ? $bundle->date('time') : print '--'?></time>
</td>
<td data-sort-value="<?php $bundle->f('size','%u')?>">
<?php $bundle->n('size')?>
</td>
</tr><?php
endforeach;?>
</tbody>
</table>

View file

@ -0,0 +1,54 @@
<?php
/**
* Listing of installed languages
*/
$this->extend('../layout');
echo $this->render('../common/inc-table-filter');
?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Locale name', 'loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Locale code', 'loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Last modified','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Files found', 'loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Site language', 'loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
/* @var $p Loco_mvc_Params */
foreach( $locales as $p ):?>
<tr>
<td>
<a href="<?php $p->e('href')?>" class="row-title">
<span <?php echo $p->lattr?>><code><?php $p->e('lcode')?></code></span>
<span><?php $p->e('lname')?></span>
</a>
</td>
<td>
<?php $p->e('lcode')?>
</td>
<td data-sort-value="<?php $p->f('time','%u')?>">
<time datetime="<?php $p->date('time','c')?>"><?php $p->time ? $p->date('time') : print '--'?></time>
</td>
<td data-sort-value="<?php $p->e('nfiles')?>">
<?php $p->n('nfiles',0)?>
</td>
<td class="loco-<?php echo $p->active?'is':'not' ?>-active">
<?php $p->e('used')?>
</td>
</tr><?php
endforeach?>
</tbody>
</table>

View file

@ -0,0 +1,57 @@
<?php
/**
* Root admin screen
*/
$this->extend('layout');
?>
<div class="notice inline notice-info">
<p class="has-lang">
<span <?php echo $siteLocale->attr?>><code><?php $siteLocale->e('code')?></code></span>
<span><?php printf( esc_html( __('The language of this site is %s.','loco-translate') ), $siteLocale->link );?>
<?php if( $params->has('adminLocale') ):
printf( esc_html( __('Your admin language is %s.','loco-translate') ), $adminLocale->link );
endif?></span>
</p>
</div><?php
if( $recent ):?>
<div>
<h2>
<?php esc_html_e('Recently updated:','loco-translate')?>
</h2>
<p>
<?php esc_html_e("Translations have been recently modified in the following bundles",'loco-translate')?>:
</p><?php
echo $this->render('list/inc-table', array( 'bundles' => $recent ) );?>
</div><?php
endif;?>
<div>
<h2>
<?php esc_html_e('Active theme:','loco-translate')?>
</h2><?php
echo $this->render('list/inc-table', array( 'bundles' => array($theme) ) )?>
<p>
<a href="<?php $this->route('theme')->e('href')?>" class="button button-link has-raquo"><?php esc_html_e('See all themes','loco-translate')?></a>
</p>
</div>
<?php if( $plugins ):?>
<div>
<h2>
<?php esc_html_e('Running plugins:','loco-translate')?>
</h2>
<p>
<?php esc_html_e('These plugins have recently loaded translation files into the admin area','loco-translate')?>:
</p><?php
echo $this->render('list/inc-table', array( 'bundles' => $plugins ) )?>
<p>
<a href="<?php $this->route('plugin')->e('href')?>" class="button button-link has-raquo"><?php esc_html_e('See all plugins','loco-translate')?></a>
</p>
</div><?php
endif;