Dotclear

Changeset 1726 for plugins/translater


Ignore:
Timestamp:
10/25/09 17:33:31 (14 years ago)
Author:
JcDenis
Message:

translater 1.3:

  • Added babelfish help
  • Added behaviors on files writing
  • Fixed regexp again
  • Changed priority to .po files instead of .lang.php files
Location:
plugins/translater
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • plugins/translater/_define.php

    r1565 r1726  
    1717     /* Description*/         "Translate your Dotclear plugins and themes", 
    1818     /* Author */        "JC Denis", 
    19      /* Version */       '1.2', 
     19     /* Version */       '1.3', 
    2020     /* Permissions */        'admin,translater' 
    2121); 
    22      /* date */          #20091010 
     22     /* date */          #20091026 
    2323?> 
  • plugins/translater/_prepend.php

    r1565 r1726  
    2929     ); 
    3030} 
     31# yahoo babelfish tools 
     32$__autoload['babelfishProposal'] = dirname(__FILE__).'/inc/lib.translater.babelfish.php'; 
     33$core->addBehavior('dcTranslaterAddProposal','addBabelfishProposalTool'); 
     34function addBabelfishProposalTool($core,$proposal) 
     35{ 
     36     $proposal->addTool( 
     37          'babelfish','Babelfish translation',array('babelfishProposal','init') 
     38     ); 
     39} 
    3140?> 
  • plugins/translater/inc/class.dc.translater.php

    r1622 r1726  
    965965               { 
    966966                    # php files 
    967                     if (preg_match_all("|__\((['\"]{1})(.*)([\"']{1})\)|",$content,$matches)) 
     967                    //if (preg_match_all("|__\((['\"]{1})(.*)([\"']{1})\)|U",$content,$matches)) 
     968                    if (preg_match_all("|__\((['\"]{1})(.*?)([\"']{1})\)|",$content,$matches)) 
    968969                    { 
    969970                         foreach($matches[2] as $id) 
     
    10101011          foreach($langs[$requested_lang] as $file) 
    10111012          { 
     1013               # .po files 
     1014               if (self::isPoFile($file)) 
     1015               { 
     1016                    $po = self::getPoFile($locales.'/'.$file); 
     1017                    if (!is_array($po)) continue; 
     1018 
     1019                    foreach($po as $id => $str) 
     1020                    { 
     1021                         $is_po[$requested_lang][$id] = 1; 
     1022 
     1023                         $res[] = array( 
     1024                              'msgid' => self::encodeMsg($id), 
     1025                              'msgstr' => self::encodeMsg($str), 
     1026                              'lang' => $requested_lang, 
     1027                              'type' => 'po', 
     1028                              'path' => $locales.'/'.$file, 
     1029                              'file' => basename($file), 
     1030                              'group'=> str_replace('.po','',basename($file)) 
     1031                         ); 
     1032                    } 
     1033               } 
    10121034               # .lang.php files 
    1013                if (self::isLangphpFile($file)) 
     1035               elseif (self::isLangphpFile($file)) 
    10141036               { 
    10151037                    $php = self::getLangphpFile($locales.'/'.$file); 
    10161038                    foreach($php AS $id => $str) 
    10171039                    { 
    1018                          $is_php[$requested_lang][$id] = 1; 
     1040                         # Don't overwrite .po 
     1041                         if (isset($is_po[$requested_lang][$id])) continue; 
    10191042                         $res[] = array( 
    10201043                              'msgid' => self::encodeMsg($id), 
     
    10281051                    } 
    10291052               } 
    1030                # .po files 
    1031                elseif (self::isPoFile($file)) 
    1032                { 
    1033                     $po = self::getPoFile($locales.'/'.$file); 
    1034                     if (!is_array($po)) continue; 
    1035  
    1036                     foreach($po as $id => $str) 
    1037                     { 
    1038                          # Don't overwrite .lang.php 
    1039                          if (isset($is_php[$requested_lang][$id])) continue; 
    1040  
    1041                          $res[] = array( 
    1042                               'msgid' => self::encodeMsg($id), 
    1043                               'msgstr' => self::encodeMsg($str), 
    1044                               'lang' => $requested_lang, 
    1045                               'type' => 'po', 
    1046                               'path' => $locales.'/'.$file, 
    1047                               'file' => basename($file), 
    1048                               'group'=> str_replace('.po','',basename($file)) 
    1049                          ); 
    1050                     } 
    1051                } 
    10521053          } 
    10531054          return $res; 
     
    12251226                    if (isset($fields[$info['msgid']])) 
    12261227                    { 
    1227                          $comments[$info['msgid']] = (!isset($comments[$info['msgid']]) ? 
     1228                         $comments[$info['msgid']] = (isset($comments[$info['msgid']]) ? 
    12281229                              $comments[$info['msgid']] : ''). 
    12291230                              '#'.trim($info['file'],'/').':'.$info['line']."\n"; 
     
    13261327               } 
    13271328               $l .=  
    1328                     '# Translated with dcTranslater - '.$this->core->plugins->moduleInfo('translater','version')."\n"; 
     1329                    '# Translated with translater '.$this->core->plugins->moduleInfo('translater','version')."\n"; 
    13291330          } 
    13301331          $l .=  
    1331           "\nmsgid \"\"\n". 
    1332           'msgstr "Content-Type: text/plain; charset=UTF-8\n"'."\n\n"; 
     1332          "\n". 
     1333          "msgid \"\"\n". 
     1334          "msgstr \"\"\n". 
     1335          '"Content-Type: text/plain; charset=UTF-8\n"'."\n". 
     1336          '"Project-Id-Version: '.$module.' '.self::moduleInfo($module,'version').'\n"'."\n". 
     1337          '"POT-Creation-Date: \n"'."\n". 
     1338          '"PO-Revision-Date: '.date('U').'\n"'."\n". 
     1339          '"Last-Translator: '.$this->core->auth->getInfo('user_cn').'\n"'."\n". 
     1340          '"Language-Team: \n"'."\n". 
     1341          '"MIME-Version: 1.0\n"'."\n". 
     1342          '"Content-Transfer-Encoding: 8bit\n"'."\n\n"; 
    13331343 
    13341344          if ($this->parse_comment) 
     
    13391349                    if (isset($fields[$info['msgid']])) 
    13401350                    { 
    1341                          $comments[$info['msgid']] = (!isset($comments[$info['msgid']]) ? 
     1351                         $comments[$info['msgid']] = (isset($comments[$info['msgid']]) ? 
    13421352                              $comments[$info['msgid']] : ''). 
    13431353                              '#: '.trim($info['file'],'/').':'.$info['line']."\n"; 
  • plugins/translater/inc/lib.translater.google.php

    r1565 r1726  
    6060     { 
    6161          return preg_match('/<div id=result_box dir="ltr">(.+?)<\/div>/',$rs,$m) ? 
    62                strip_tags(str_replace('&nbsp;','',$m[0])) : 
     62               str_replace('% ','%',$m[1]) : 
    6363               ''; 
    6464     }  
  • plugins/translater/inc/module.php

    r1565 r1726  
    449449     '</tr>'. 
    450450     '</table>'. 
     451     '<p>'.sprintf(__('Total of %s strings.'),$i-1).'</p>'. 
    451452     '<p class="col checkboxes-helpers"></p>'. 
    452453     '<p class="col right">'.__('Change the group of the selected entries to:').' '. 
  • plugins/translater/index.php

    r1565 r1726  
    6363     'setting' => __('Settings'), 
    6464     'summary' => __('Summary'), 
    65      'lang' => __('Add/Remove/Edit'), 
     65     'lang' => __('Translations'), 
    6666     'backup' => __('Backups') 
    6767); 
  • plugins/translater/locales/fr/admin.lang.php

    r1565 r1726  
    1212 
    1313// Language: français  
    14 // Module: translater - 1.2 
    15 // Date: 2009-10-10 02:48:12  
    16 // Translated with dcTranslater - 1.2  
     14// Module: translater - 1.3 
     15// Date: 2009-10-25 15:09:20  
     16// Translated with dcTranslater - 1.3  
    1717 
    1818#index.php:72 
  • plugins/translater/locales/fr/admin.po

    r1565 r1726  
    11# Language: français 
    2 # Module: translater - 1.2 
    3 # Date: 2009-10-10 02:48:13 
    4 # Translated with dcTranslater - 1.2 
     2# Module: translater - 1.3 
     3# Date: 2009-10-25 15:09:21 
     4# Translated with translater 1.3 
    55 
    66msgid "" 
    7 msgstr "Content-Type: text/plain; charset=UTF-8\n" 
     7msgstr "" 
     8"Content-Type: text/plain; charset=UTF-8\n" 
     9"Project-Id-Version: translater 1.3\n" 
     10"POT-Creation-Date: \n" 
     11"PO-Revision-Date: 1256483361\n" 
     12"Last-Translator: JC Denis\n" 
     13"Language-Team: \n" 
     14"MIME-Version: 1.0\n" 
     15"Content-Transfer-Encoding: 8bit\n" 
    816 
    917#: index.php:72 
  • plugins/translater/locales/fr/error.lang.php

    r1565 r1726  
    1212 
    1313// Language: français  
    14 // Module: translater - 1.2 
    15 // Date: 2009-10-10 02:48:12  
    16 // Translated with dcTranslater - 1.2  
     14// Module: translater - 1.3 
     15// Date: 2009-10-25 15:09:20  
     16// Translated with dcTranslater - 1.3  
    1717 
    1818#inc/class.dc.translater.php:300 
     
    3434$GLOBALS['__l10n']['Limit of %s backups for module %s exceed'] = 'La limite de %s sauvegardes pour le module % est dépassée'; 
    3535 
     36#inc/class.dc.translater.php:492 
     37#inc/class.dc.translater.php:855 
    3638#inc/class.dc.translater.php:921 
    3739$GLOBALS['__l10n']['Cannot find language folder %s for module %s'] = 'Impossible de trouver le dossier de langue %s pour le module %s'; 
     
    6769$GLOBALS['__l10n']['No string to write, language %s deleted for module %s'] = 'Aucune chaine à écrire, la langue %s a été effacée pour le module %s'; 
    6870 
    69 #inc/class.dc.translater.php:1139 
     71#inc/class.dc.translater.php:1140 
    7072$GLOBALS['__l10n']['Cannot grant write acces on lang file %s'] = 'Impossible d\'avoir les droits en écriture sur le fichier de langue %s'; 
    7173 
    72 #inc/class.dc.translater.php:1145 
     74#inc/class.dc.translater.php:1151 
    7375$GLOBALS['__l10n']['Cannot write lang file %s'] = 'Impossible d\'écrire le fichier de langue %s'; 
    7476 
    75 #inc/class.dc.translater.php:1405 
     77#inc/class.dc.translater.php:1425 
    7678$GLOBALS['__l10n']['Cannot find language for code %s'] = 'Impossible de trouver de langue pour le code %s'; 
    7779 
  • plugins/translater/locales/fr/error.po

    r1565 r1726  
    11# Language: français 
    2 # Module: translater - 1.2 
    3 # Date: 2009-10-10 02:48:12 
    4 # Translated with dcTranslater - 1.2 
     2# Module: translater - 1.3 
     3# Date: 2009-10-25 15:09:20 
     4# Translated with translater 1.3 
    55 
    66msgid "" 
    7 msgstr "Content-Type: text/plain; charset=UTF-8\n" 
     7msgstr "" 
     8"Content-Type: text/plain; charset=UTF-8\n" 
     9"Project-Id-Version: translater 1.3\n" 
     10"POT-Creation-Date: \n" 
     11"PO-Revision-Date: 1256483360\n" 
     12"Last-Translator: JC Denis\n" 
     13"Language-Team: \n" 
     14"MIME-Version: 1.0\n" 
     15"Content-Transfer-Encoding: 8bit\n" 
    816 
    917#: inc/class.dc.translater.php:300 
     
    3139msgstr "La limite de %s sauvegardes pour le module % est dépassée" 
    3240 
     41#: inc/class.dc.translater.php:492 
     42#: inc/class.dc.translater.php:855 
    3343#: inc/class.dc.translater.php:921 
    3444msgid "Cannot find language folder %s for module %s" 
     
    7585msgstr "Aucune chaine à écrire, la langue %s a été effacée pour le module %s" 
    7686 
    77 #: inc/class.dc.translater.php:1139 
     87#: inc/class.dc.translater.php:1140 
    7888msgid "Cannot grant write acces on lang file %s" 
    7989msgstr "Impossible d'avoir les droits en écriture sur le fichier de langue %s" 
    8090 
    81 #: inc/class.dc.translater.php:1145 
     91#: inc/class.dc.translater.php:1151 
    8292msgid "Cannot write lang file %s" 
    8393msgstr "Impossible d'écrire le fichier de langue %s" 
    8494 
    85 #: inc/class.dc.translater.php:1405 
     95#: inc/class.dc.translater.php:1425 
    8696msgid "Cannot find language for code %s" 
    8797msgstr "Impossible de trouver de langue pour le code %s" 
  • plugins/translater/locales/fr/main.lang.php

    r1565 r1726  
    1212 
    1313// Language: français  
    14 // Module: translater - 1.2 
    15 // Date: 2009-10-10 02:48:12  
    16 // Translated with dcTranslater - 1.2  
     14// Module: translater - 1.3 
     15// Date: 2009-10-25 15:09:20  
     16// Translated with dcTranslater - 1.3  
    1717 
    1818#_admin.php:16 
     
    2525$GLOBALS['__l10n']['manage translations'] = 'Gèrer les traductions'; 
    2626 
     27#_admin.php:24 
     28#inc/module.php:29 
     29#inc/modules.php:18 
     30#inc/simple.php:24 
    2731#index.php:269 
    2832$GLOBALS['__l10n']['Translater'] = 'Traducteur'; 
    2933 
     34#_admin.php:49 
    3035#index.php:59 
    3136$GLOBALS['__l10n']['Translate extensions'] = 'Traduire les extensions'; 
    3237 
     38#_admin.php:53 
     39#inc/module.php:44 
     40#inc/modules.php:111 
    3341#inc/modules.php:160 
    3442$GLOBALS['__l10n']['Name'] = 'Nom'; 
    3543 
     44#_admin.php:64 
    3645#inc/modules.php:124 
    3746$GLOBALS['__l10n']['Translate this plugin'] = 'Traduire cette extension'; 
    3847 
     48#_admin.php:81 
    3949#inc/modules.php:173 
    4050$GLOBALS['__l10n']['Translate this theme'] = 'Traduire ce thème'; 
     
    5262$GLOBALS['__l10n']['Module'] = 'Module'; 
    5363 
     64#inc/module.php:42 
    5465#index.php:58 
    5566$GLOBALS['__l10n']['About'] = 'À propos'; 
     
    5869$GLOBALS['__l10n']['Root'] = 'Racine'; 
    5970 
     71#inc/module.php:54 
     72#inc/module.php:68 
     73#inc/modules.php:80 
    6074#index.php:66 
    6175$GLOBALS['__l10n']['Backups'] = 'Sauvegardes'; 
     
    7084$GLOBALS['__l10n']['Edit language'] = 'Modifier la langue'; 
    7185 
     86#inc/module.php:109 
     87#inc/module.php:128 
    7288#inc/module.php:156 
    7389$GLOBALS['__l10n']['Select language:'] = 'Selectionner une langue :'; 
     
    91107$GLOBALS['__l10n']['Delete language'] = 'Effacer une langue'; 
    92108 
     109#inc/module.php:158 
    93110#inc/simple.php:124 
    94111$GLOBALS['__l10n']['Delete translation'] = 'Effacer la traduction'; 
     
    106123$GLOBALS['__l10n']['List of backups'] = 'Liste des sauvegardes'; 
    107124 
     125#inc/module.php:219 
    108126#inc/module.php:396 
    109127$GLOBALS['__l10n']['File'] = 'Fichier'; 
     
    121139$GLOBALS['__l10n']['Delete backups'] = 'Effacer les sauvegardes'; 
    122140 
     141#inc/module.php:271 
    123142#inc/modules.php:211 
    124143$GLOBALS['__l10n']['Choose package to import'] = 'Choisir le paquetage à importer'; 
    125144 
     145#inc/module.php:291 
    126146#inc/modules.php:257 
    127147$GLOBALS['__l10n']['Choose languages to export'] = 'Choisir les langues à exporter'; 
     
    130150$GLOBALS['__l10n']['Group'] = 'Groupe'; 
    131151 
     152#inc/module.php:394 
    132153#inc/simple.php:190 
    133154$GLOBALS['__l10n']['String'] = 'Chaine'; 
    134155 
     156#inc/module.php:398 
     157#inc/modules.php:42 
    135158#inc/simple.php:191 
    136159$GLOBALS['__l10n']['Translation'] = 'Traduction'; 
    137160 
     161#inc/module.php:399 
    138162#inc/simple.php:192 
    139163$GLOBALS['__l10n']['Existing'] = 'Existant'; 
     
    142166$GLOBALS['__l10n']['%s in %m => %f'] = '%s dans %m => %f'; 
    143167 
    144 #inc/module.php:452 
     168#inc/module.php:451 
     169$GLOBALS['__l10n']['Total of %s strings.'] = 'Total de %s chaines.'; 
     170 
     171#inc/module.php:453 
    145172$GLOBALS['__l10n']['Change the group of the selected entries to:'] = 'Changer le groupe des entrées sélectionnées vers :'; 
    146173 
     
    257284 
    258285#index.php:65 
    259 $GLOBALS['__l10n']['Add/Remove/Edit'] = 'Ajouter/Supprimer/Modifier'; 
     286$GLOBALS['__l10n']['Translations'] = 'Traductions'; 
    260287 
    261288#index.php:287 
  • plugins/translater/locales/fr/main.po

    r1565 r1726  
    11# Language: français 
    2 # Module: translater - 1.2 
    3 # Date: 2009-10-10 02:48:12 
    4 # Translated with dcTranslater - 1.2 
     2# Module: translater - 1.3 
     3# Date: 2009-10-25 15:09:20 
     4# Translated with translater 1.3 
    55 
    66msgid "" 
    7 msgstr "Content-Type: text/plain; charset=UTF-8\n" 
     7msgstr "" 
     8"Content-Type: text/plain; charset=UTF-8\n" 
     9"Project-Id-Version: translater 1.3\n" 
     10"POT-Creation-Date: \n" 
     11"PO-Revision-Date: 1256483360\n" 
     12"Last-Translator: JC Denis\n" 
     13"Language-Team: \n" 
     14"MIME-Version: 1.0\n" 
     15"Content-Transfer-Encoding: 8bit\n" 
    816 
    917#: _admin.php:16 
     
    1927msgstr "Gèrer les traductions" 
    2028 
     29#: _admin.php:24 
     30#: inc/module.php:29 
     31#: inc/modules.php:18 
     32#: inc/simple.php:24 
    2133#: index.php:269 
    2234msgid "Translater" 
    2335msgstr "Traducteur" 
    2436 
     37#: _admin.php:49 
    2538#: index.php:59 
    2639msgid "Translate extensions" 
    2740msgstr "Traduire les extensions" 
    2841 
     42#: _admin.php:53 
     43#: inc/module.php:44 
     44#: inc/modules.php:111 
    2945#: inc/modules.php:160 
    3046msgid "Name" 
    3147msgstr "Nom" 
    3248 
     49#: _admin.php:64 
    3350#: inc/modules.php:124 
    3451msgid "Translate this plugin" 
    3552msgstr "Traduire cette extension" 
    3653 
     54#: _admin.php:81 
    3755#: inc/modules.php:173 
    3856msgid "Translate this theme" 
     
    5573msgstr "Module" 
    5674 
     75#: inc/module.php:42 
    5776#: index.php:58 
    5877msgid "About" 
     
    6382msgstr "Racine" 
    6483 
     84#: inc/module.php:54 
     85#: inc/module.php:68 
     86#: inc/modules.php:80 
    6587#: index.php:66 
    6688msgid "Backups" 
     
    79101msgstr "Modifier la langue" 
    80102 
     103#: inc/module.php:109 
     104#: inc/module.php:128 
    81105#: inc/module.php:156 
    82106msgid "Select language:" 
     
    107131msgstr "Effacer une langue" 
    108132 
     133#: inc/module.php:158 
    109134#: inc/simple.php:124 
    110135msgid "Delete translation" 
     
    127152msgstr "Liste des sauvegardes" 
    128153 
     154#: inc/module.php:219 
    129155#: inc/module.php:396 
    130156msgid "File" 
     
    147173msgstr "Effacer les sauvegardes" 
    148174 
     175#: inc/module.php:271 
    149176#: inc/modules.php:211 
    150177msgid "Choose package to import" 
    151178msgstr "Choisir le paquetage à importer" 
    152179 
     180#: inc/module.php:291 
    153181#: inc/modules.php:257 
    154182msgid "Choose languages to export" 
     
    159187msgstr "Groupe" 
    160188 
     189#: inc/module.php:394 
    161190#: inc/simple.php:190 
    162191msgid "String" 
    163192msgstr "Chaine" 
    164193 
     194#: inc/module.php:398 
     195#: inc/modules.php:42 
    165196#: inc/simple.php:191 
    166197msgid "Translation" 
    167198msgstr "Traduction" 
    168199 
     200#: inc/module.php:399 
    169201#: inc/simple.php:192 
    170202msgid "Existing" 
     
    175207msgstr "%s dans %m => %f" 
    176208 
    177 #: inc/module.php:452 
     209#: inc/module.php:451 
     210msgid "Total of %s strings." 
     211msgstr "Total de %s chaines." 
     212 
     213#: inc/module.php:453 
    178214msgid "Change the group of the selected entries to:" 
    179215msgstr "Changer le groupe des entrées sélectionnées vers :" 
     
    328364 
    329365#: index.php:65 
    330 msgid "Add/Remove/Edit" 
    331 msgstr "Ajouter/Supprimer/Modifier" 
     366msgid "Translations" 
     367msgstr "Traductions" 
    332368 
    333369#: index.php:287 
  • plugins/translater/release.txt

    r1565 r1726  
    11x.x xxxxxxxx 
    2  - Added help translation 
     2 - Add help translation 
     3 
     41.3 xxxxxxxx 
     5 * Added babelfish help 
     6 * Added behaviors on files writing 
     7 * Fixed regexp again 
     8 * Changed priority to .po files instead of .lang.php files 
    39 
    4101.2 20091010 
Note: See TracChangeset for help on using the changeset viewer.

Sites map