Changeset 90036 in spip-zone
- Timestamp:
- Jun 9, 2015, 10:10:29 AM (6 years ago)
- Location:
- _plugins_/trad-lang/trunk/formulaires
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/trad-lang/trunk/formulaires/tradlang_importer_langue.html
r82035 r90036 17 17 <input type="submit" class="submit" value="<:tradlang:bouton_suivant:>" /> 18 18 </p> 19 </div> </form>20 ]19 </div> 20 </form>] 21 21 </div> -
_plugins_/trad-lang/trunk/formulaires/tradlang_importer_langue.php
r90022 r90036 74 74 if(file_exists($dest_po)){ 75 75 lire_fichier($dest_po,$contenu_po); 76 preg_match_all(',(\#\, php-format|\#\, fuzzy\, php-format).*msgstr .*\"\n,Uims', $contenu_po,$matches);76 preg_match_all(',(\#\, php-format|\#\, fuzzy\, php-format).*msgstr(.*)\#,Uims', $contenu_po,$matches); 77 77 $array_po = array(); 78 78 foreach($matches[0] as $match){ 79 79 $statut = "OK"; 80 80 preg_match(',\#\| msgid \"(.*)\"\n,Uims',$match,$matches); 81 preg_match(',^msgstr \"(.*)(\"\n),Uims',$match,$matches_str); 82 $str = $matches_str[1]; 81 preg_match(',msgstr \"(.*)\n\#,Uims',$match,$matches_str); 82 $str = rtrim(trim($matches_str[1]),'"'); 83 $str = trim(str_replace("\"\n\"","\n",$str)); 83 84 if(preg_match(',\#\, fuzzy\, php-format,',$match,$matches_statut)) 84 85 $statut = "MODIF"; … … 90 91 foreach($langues_base as $strings_id => $strings){ 91 92 $str_lang[$strings['id']] = tradlang_utf8(preg_replace(',^(<(MODIF|NEW|PLUS_UTILISE)>)+,US', '', $str_lang[$strings['id']])); 92 93 93 if(isset($array_po[$strings['id']]['str']) && strlen(trim($array_po[$strings['id']]['str'])) > 0){ 94 94 if(($strings['str'] != $array_po[$strings['id']]['str']) OR ($strings['statut'] != $array_po[$strings['id']]['statut'])){ … … 111 111 112 112 function formulaires_tradlang_importer_langue_verifier_1_dist($id_tradlang_module,$lang) { 113 $erreurs = array(); 113 114 if(_request('_etape')==1){ 114 115 $module = sql_getfetsel('module','spip_tradlang_modules','id_tradlang_module='.intval($id_tradlang_module)); … … 191 192 else{ 192 193 lire_fichier($dest,$contenu_po); 193 preg_match_all(',(\#\, php-format|\#\, fuzzy\, php-format).*msgstr .*\"\n,Uims', $contenu_po,$matches);194 preg_match_all(',(\#\, php-format|\#\, fuzzy\, php-format).*msgstr(.*)\#,Uims', $contenu_po,$matches); 194 195 $array_po = array(); 195 196 foreach($matches[0] as $match){ 196 197 $statut = "OK"; 197 198 preg_match(',\#\| msgid \"(.*)\"\n,Uims',$match,$matches); 198 preg_match(',^msgstr \"(.*)(\"\n),Uims',$match,$matches_str); 199 $str = $matches_str[1]; 199 preg_match(',msgstr \"(.*)\n\#,Uims',$match,$matches_str); 200 $str = rtrim(trim($matches_str[1]),'"'); 201 $str = trim(str_replace("\"\n\"","\n",$str)); 200 202 if(preg_match(',\#\, fuzzy\, php-format,',$match,$matches_statut)) 201 203 $statut = "MODIF"; … … 225 227 $erreurs['fichier_langue'] = _T('tradlang:erreur_upload_aucune_modif'); 226 228 } 229 spip_log($modifs,'test.'._LOG_ERREUR); 227 230 return $erreurs; 228 231 } … … 235 238 $dest = $dir_lang.$fichier_php; 236 239 $destpo = $dir_lang.$fichier_po; 237 $modifs = array();240 $modifs = $erreurs = array(); 238 241 if(file_exists($dest)){ 239 242 $memtrad = $GLOBALS['idx_lang'] = 'i18n_'.crc32($module).'_tmp'; … … 261 264 if(!count($modifs)) 262 265 $erreurs['message_erreur'] = _T('tradlang:erreur_upload_choisir_une'); 266 spip_log($modifs,'test.'._LOG_ERREUR); 263 267 return $erreurs; 264 268 } … … 266 270 function formulaires_tradlang_importer_langue_traiter_dist($id_tradlang_module,$lang) { 267 271 include_spip('action/editer_tradlang'); 268 272 269 273 $module = sql_getfetsel('module','spip_tradlang_modules','id_tradlang_module='.intval($id_tradlang_module)); 270 274 $fichier_php = $module.'_'.$lang.'.php'; … … 318 322 } 319 323 spip_unlink($dest); 320 }else if(file_exists($dest = $dir_lang.$fichier_po)){ 324 } 325 else if(file_exists($dest = $dir_lang.$fichier_po)){ 321 326 lire_fichier($dest,$contenu_po); 322 preg_match_all(',(\#\, php-format|\#\, fuzzy\, php-format).*msgstr .*\"\n,Uims', $contenu_po,$matches);327 preg_match_all(',(\#\, php-format|\#\, fuzzy\, php-format).*msgstr(.*)\#,Uims', $contenu_po,$matches); 323 328 $array_po = array(); 324 329 foreach($matches[0] as $match){ 325 330 $statut = "OK"; 326 331 preg_match(',\#\| msgid \"(.*)\"\n,Uims',$match,$matches); 327 preg_match(',^msgstr \"(.*)(\"\n),Uims',$match,$matches_str); 328 $str = $matches_str[1]; 332 preg_match(',msgstr \"(.*)\n\#,Uims',$match,$matches_str); 333 $str = rtrim(trim($matches_str[1]),'"'); 334 $str = trim(str_replace("\"\n\"","\n",$str)); 329 335 if(preg_match(',\#\, fuzzy\, php-format,',$match,$matches_statut)){ 330 336 $statut = "MODIF"; -
_plugins_/trad-lang/trunk/formulaires/tradlang_importer_langue_2.html
r83954 r90036 7 7 #ACTION_FORMULAIRE{#ENV{action},#FORM} 8 8 <h3 class="titrem"><:tradlang:titre_form_import_step_2:></h3> 9 <B_modifs> 9 10 <ul> 10 11 <li> … … 52 53 </li> 53 54 </ul> 55 </B_modifs> 54 56 <p class="boutons"> 55 56 57 <input type="submit" name="_retour_etape_1" class="submit" value="<:tradlang:bouton_precedent:>" /> 58 <input type="submit" class="submit" value="<:tradlang:bouton_suivant:>" /> 57 59 </p> 58 60 </div></form>
Note: See TracChangeset
for help on using the changeset viewer.