<?php

/**
 * Status tab – i18n.
 *
 * @package northmill-online-shared
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Sync;

/**
 * View parameters.
 *
 * @var array $params
 */
use Northmill_Online_Shared_Sync\Northmill_Online_Shared\Modules\i18n\Models\Abstract_Translation_Model;
\defined('ABSPATH') || exit;
/**
 * Translations
 *
 * @var Abstract_Translation_Model[] $translations
 */
$translations = $params['translations'] ?? array();
?>
<h2><?php 
\esc_html_e('Translations', 'northmill-online-shared');
?></h2>
<table class="nmf-sync-table">
	<thead>
		<tr>
			<th><?php 
\esc_html_e('Text domain', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('Locale', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('Relative path', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('Absolute path', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('Full path', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('mofile name', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('mofile prefix', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('Priority', 'northmill-online-shared');
?></th>
			<th><?php 
\esc_html_e('Is from plugin', 'northmill-online-shared');
?></th>
		</tr>
	</thead>
	<tbody>
	<?php 
foreach ($translations as $translation) {
    $data = $translation->get_data();
    echo '<tr>';
    echo '<td>' . \esc_html($data['textdomain']) . '</td>';
    echo '<td>' . \esc_html($data['locale']) . '</td>';
    echo '<td>' . \esc_html($data['path_rel']) . '</td>';
    echo '<td>' . \esc_html($data['path_abs']) . '</td>';
    echo '<td>' . \esc_html($data['full_path']) . '</td>';
    echo '<td>' . \esc_html($data['mofile_name']) . '</td>';
    echo '<td>' . \esc_html($data['mofile_prefix']) . '</td>';
    echo '<td>' . \esc_html($data['priority']) . '</td>';
    echo '<td><span class="dashicons ' . ($data['is_plugin'] ? 'dashicons-yes' : 'dashicons-no') . '"></span></td>';
    echo '</tr>';
}
?>
	</tbody>
</table>
<?php 
