Traductions manquantes dans PluXml

bazooka07bazooka07 Membre

Bonjour,

Ci-dessous un simple script en PHP pour lister les traductions manquantes dans PluXml :

#!/usr/bin/env php
<?php
define('ROOT', (basename(dirname(__DIR__)) == 'plugins') ? substr(dirname(__DIR__), 0, -strlen('plugins')) : __DIR__ . '/');
$langs = array('de', 'en', 'es', 'it', 'nl', 'oc', 'pl', 'pt', 'ro', 'ru');

$pattern = ROOT . 'core/lang/%s/%s.php';
$files = array('admin', 'core', 'install', 'update');
$tokens = array();

echo "\e[33mChecking translations in the core of PluXml from french\e[m". PHP_EOL . PHP_EOL;
echo 'Filenames as sources :' . PHP_EOL;
foreach($files as $file) {
   $filename = sprintf($pattern, 'fr', $file);
   echo $filename . PHP_EOL;
   include $filename;
   $tokens[$file] = array_keys($LANG);
}
echo PHP_EOL;

foreach($langs as $lang) {
   echo "\e[32mLanguage: $lang \e[m". PHP_EOL;
   foreach($files as $file) {
      echo 'Filename: ' . $file . '.php : ';
      include sprintf($pattern, $lang, $file);
      $diff = array_diff($tokens[$file], array_keys($LANG));
      if(count($diff) > 0) {
         echo "\e[31mmissing\e[m" . PHP_EOL . "\t";
         echo implode(PHP_EOL . "\t", $diff) . PHP_EOL;
      } else {
         echo 'Ok' . PHP_EOL;
      }
   }
   echo PHP_EOL;
}
?>

Placer le script dans le dossier où est installé PluXml. Nommer le fichier "check-core.php" par exemple et exécuter dans un terminal

Donner les droits d'execution par "chmod a+x check-core.php" et utiliser la commande "./check-core.php"

Sinon "php -f check-core.php".

Mots clés:

Réponses

  • Pour PluXml-5.8, voici le résultat:

    jpierre@smartteck:/home/www/test/PluXml-5.8/plugins/kzUploader$ ./check-core.php 
    Checking translations in the core of PluXml from french
    
    Filenames as sources :
    /home/www/test/PluXml-5.8/core/lang/fr/admin.php
    /home/www/test/PluXml-5.8/core/lang/fr/core.php
    /home/www/test/PluXml-5.8/core/lang/fr/install.php
    /home/www/test/PluXml-5.8/core/lang/fr/update.php
    
    Language: de 
    Filename: admin.php : missing
       L_CONFIG_ADVANCED_EMAIL_SENDING_TITLE_HELP
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: en 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: es 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: it 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: nl 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: oc 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: pl 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: pt 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: ro 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    
    Language: ru 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : missing
       L_ERR_MISSING_EMAIL
    Filename: update.php : Ok
    


  • Pour PluXml 5.7, voilà le résultat :

    jpierre@smartteck:/home/www/test/PluXml-5.7$ ./check-core.php 
    Checking translations in the core of PluXml from french
    
    Filenames as sources :
    /home/www/test/PluXml-5.7/core/lang/fr/admin.php
    /home/www/test/PluXml-5.7/core/lang/fr/core.php
    /home/www/test/PluXml-5.7/core/lang/fr/install.php
    /home/www/test/PluXml-5.7/core/lang/fr/update.php
    
    Language: de 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: en 
    Filename: admin.php : Ok
    Filename: core.php : Ok
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: es 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: it 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: nl 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: oc 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: pl 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: pt 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: ro 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    
    Language: ru 
    Filename: admin.php : Ok
    Filename: core.php : missing
       L_LONG_JANUARY
       L_LONG_FEBRUARY
       L_LONG_MARCH
       L_LONG_APRIL
       L_LONG_MAY
       L_LONG_JUNE
       L_LONG_JULY
       L_LONG_AUGUST
       L_LONG_SEPTEMBER
       L_LONG_OCTOBER
       L_LONG_NOVEMBER
       L_LONG_DECEMBER
    Filename: install.php : Ok
    Filename: update.php : Ok
    


  • P3terP3ter Responsable de PluXml

    Très utile merci beaucoup !

    Site : p3ter.fr - Twitter : @P3terFr

  • Kube17Kube17 PluXml Staff

    Après pour les traducitons de PluXml il est peut-être opportun de penser à un logiciel de traduction collaboratif.

    Dans les exemples opensource il faut voir avec Weblate. Ils ont une solution libre et auto-hébergée sinon il est possible de les contacter pour les projets libres qu'ils peuvent héberger gratuitement (c'est pas du PHP c'est du python). https://weblate.org/fr/hosting/

    Sinon il y a d'autres plates formes de tradution (Localize.biz, Transifex) mais elles sont payantes et non libres.

    🇨🇵🇬🇧 MP - Mail - unkorneglosk.fr - Twitter - Je suis modérateur, je dois donc modérater. Ou modérationner. Ou je sais plus. Mais je le fais.

Connectez-vous ou Inscrivez-vous pour répondre.