Désactivation temporaire des langues

This commit is contained in:
fredtempez 2020-11-25 14:04:04 +01:00
parent 6b329558dd
commit b0272b4761
3 changed files with 107 additions and 115 deletions

15
.gitignore vendored
View File

@ -36,9 +36,12 @@ site/data/journal.log
.DS_Store
site/.DS_Store
site/file/.DS_Store
site/tmp/5f7f5e998762c.png
site/tmp/5f7f5e9987628.png
site/tmp/5f7f5ea3e983b.png
site/tmp/5f7f5ea3e9837.png
site/tmp/5f7f5ea20d5eb.png
site/tmp/5f7f5ea20d5ee.png
site/data/es/locale.json
site/data/es/module.json
site/data/es/page.json
site/data/en/locale.json
site/data/en/module.json
site/data/en/page.json
site/data/de/locale.json
site/data/de/module.json
site/data/de/page.json

View File

@ -44,7 +44,7 @@ class common {
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '10.4.00.007';
const ZWII_VERSION = '10.4.00.008';
const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = [];
@ -151,6 +151,8 @@ class common {
'nl' => 'Néerlandais (nl)',
'pt' => 'Portugais (pt)',
];
// Langue courante
public static $i18nCurrent = 'fr';
public static $timezone;
private $url = '';
// Données de site
@ -189,13 +191,18 @@ class common {
$this->input['_COOKIE'] = $_COOKIE;
}
// Déterminer le dossier de langues
if (isset($_POST['ZWII_USER_I18N'])) {
self::$i18nCurrent = $_POST['ZWII_USER_I18N'];
}
// Instanciation de la classe des entrées / sorties
// Récupére les descripteurs
foreach ($this->dataFiles as $keys => $value) {
// Constructeur JsonDB
$this->dataFiles[$keys] = new \Prowebcraft\JsonDb([
'name' => $keys . '.json',
'dir' => $this->dirData ($keys,'fr')
'dir' => $this->dirData ($keys,self::$i18nCurrent)
]);;
}
@ -215,9 +222,9 @@ class common {
// Installation fraîche, initialisation des modules manquants
// La langue d'installation par défaut est fr
foreach ($this->dataFiles as $stageId => $item) {
$folder = $this->dirData ($stageId, 'fr');
$folder = $this->dirData ($stageId, self::$i18nCurrent);
if (file_exists($folder . $stageId .'.json') === false) {
$this->initData($stageId,'fr');
$this->initData($stageId,self::$i18nCurrent);
common::$coreNotices [] = $stageId ;
}
}
@ -2176,7 +2183,7 @@ class core extends common {
}
}
// Chargement de la librairie ggogtrans
// Chargement de la librairie googtrans
// Le multi langue est actif
if ($this->getData(['config','translate','scriptGoogle']) === true ) {
// la traduction auto est active
@ -2932,7 +2939,7 @@ class layout extends common {
if($this->getUser('group') >= self::GROUP_ADMIN) {
$rightItems .= '<li><a href="' . helper::baseUrl() . 'user" data-tippy-content="Configurer les utilisateurs">' . template::ico('users') . '</a></li>';
$rightItems .= '<li><a href="' . helper::baseUrl() . 'theme" data-tippy-content="Personnaliser les thèmes">' . template::ico('brush') . '</a></li>';
$rightItems .= '<li><a href="' . helper::baseUrl() . 'translate" data-tippy-content="Gestion des langues">' . template::ico('flag') . '</a></li>';
//$rightItems .= '<li><a href="' . helper::baseUrl() . 'translate" data-tippy-content="Gestion des langues">' . template::ico('flag') . '</a></li>';
$rightItems .= '<li><a href="' . helper::baseUrl() . 'config" data-tippy-content="Configurer le site">' . template::ico('cog-alt') . '</a></li>';
// Mise à jour automatique
$today = mktime(0, 0, 0);

View File

@ -15,125 +15,107 @@
<div class="row">
<div class="col12">
<div class="block">
<h4>Traduction automatique (Google Translate)</h4>
<h4>Langues supportées</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('translateScriptGoogle', true, 'Active le script de traduction automatique', [
'checked' => $this->getData(['config','translate', 'scriptGoogle'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique', [
'checked' => $this->getData(['config','translate', 'autoDetect']),
'help' => 'Détecte la langue du navigateur.'
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateScriptFlagFR', true, 'Français', [
'checked' => $this->getData(['config','translate', 'scriptFR'])
]); ?>
</div>
<div class="col3">
<b>Traduction automatique :</b>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagDE', true, 'Allemand', [
'checked' => $this->getData(['config','translate', 'scriptDE'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateScriptFlagEN', true, 'Anglais', [
'checked' => $this->getData(['config','translate', 'scriptEN'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::checkbox('translateScriptFlagES', true, 'Espagnol', [
'checked' => $this->getData(['config','translate', 'scriptES'])
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagEN', true, 'Anglais', [
'checked' => $this->getData(['config','translate', 'scriptEN'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateScriptFlagIT', true, 'Italien', [
'checked' => $this->getData(['config','translate', 'scriptIT'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateScriptFlagNL', true, 'Néerlandais', [
'checked' => $this->getData(['config','translate', 'scriptNL'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateScriptFlagPT', true, 'Portugais', [
'checked' => $this->getData(['config','translate', 'scriptPT'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('translateAdmin', true, 'Mode connexion', [
'checked' => $this->getData(['config','translate', 'admin']),
'help' => 'Traduction automatique du site et de l\'interface du CMS'
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagES', true, 'Espagnol', [
'checked' => $this->getData(['config','translate', 'scriptES'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagIT', true, 'Italien', [
'checked' => $this->getData(['config','translate', 'scriptIT'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagNL', true, 'Néerlandais', [
'checked' => $this->getData(['config','translate', 'scriptNL'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateScriptFlagPT', true, 'Portugais', [
'checked' => $this->getData(['config','translate', 'scriptPT'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique', [
'checked' => $this->getData(['config','translate', 'autoDetect']),
'help' => 'Détecte la langue du navigateur.'
]); ?>
</div>
</div>
<div class="col6">
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
'checked' => $this->getData(['config','translate', 'showCredits']),
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
]); ?>
<b>Traduction rédigée :</b>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagEN', true, 'Anglais', [
'checked' => $this->getData(['config', 'translate', 'siteEN'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagDE', true, 'Allemand', [
'checked' => $this->getData(['config', 'translate', 'siteDE'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagES', true, 'Espagnol', [
'checked' => $this->getData(['config', 'translate', 'siteES'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagIT', true, 'Italien', [
'checked' => $this->getData(['config', 'translate', 'siteIT'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagNL', true, 'Néerlandais', [
'checked' => $this->getData(['config', 'translate', 'siteNL'])
]); ?>
</div>
<div class="col12">
<?php echo template::checkbox('translateSiteFlagPT', true, 'Portugais', [
'checked' => $this->getData(['config', 'translate', 'sitePT'])
]); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Traduction rédigée</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('translateSite', true, 'Active la traduction manuelle', [
'checked' => $this->getData(['config','translate', 'site'])
<div class="col12">
<div class="block">
<h4>Paramètres de traduction automatique</h4>
<div class="row">
<div class="col4">
<?php echo template::checkbox('translateScriptGoogle', true, 'Active le script de traduction automatique', [
'checked' => $this->getData(['config','translate', 'scriptGoogle'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('translateAdmin', true, 'Mode connexion', [
'checked' => $this->getData(['config','translate', 'admin']),
'help' => 'Traduction automatique du site et de l\'interface du CMS'
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
'checked' => $this->getData(['config','translate', 'showCredits']),
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
]); ?>
</div>
</div>
<b>Sélectionnez les langues à activer :</b>
<div class="row">
<div class="col3">
<?php echo template::checkbox('translateSiteFlagFR', true, 'Français', [
'checked' => $this->getData(['config', 'translate', 'siteFR'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateSiteFlagDE', true, 'Allemand', [
'checked' => $this->getData(['config', 'translate', 'siteDE'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateSiteFlagEN', true, 'Anglais', [
'checked' => $this->getData(['config', 'translate', 'siteEN'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('translateSiteFlagES', true, 'Espagnol', [
'checked' => $this->getData(['config', 'translate', 'siteES'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::checkbox('translateSiteFlagIT', true, 'Italien', [
'checked' => $this->getData(['config', 'translate', 'siteIT'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('translateSiteFlagNL', true, 'Néerlandais', [
'checked' => $this->getData(['config', 'translate', 'siteNL'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('translateSiteFlagPT', true, 'Portugais', [
'checked' => $this->getData(['config', 'translate', 'sitePT'])
]); ?>
</div>
</div>
</div>
</div>