Changeset 5021 for trunk/upload.php


Ignore:
Timestamp:
Mar 2, 2010, 3:54:22 PM (14 years ago)
Author:
nikrou
Message:

Feature 1451 : localization with gettext
Use php-gettext (developpement version rev43, because of php5.3) as fallback
Use native language (english) instead of key for translation
Keep directory en_UK for english customization
Need some refactoring for plurals

Todo : managing plugins in the same way

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upload.php

    r5014 r5021  
    6262  if (!in_array($extension, $conf['picture_ext']))
    6363  {
    64     array_push( $result['error'], l10n('upload_advise_filetype') );
     64    array_push( $result['error'], l10n('the picture must be to the fileformat jpg, gif or png') );
    6565    return $result;
    6666  }
     
    7373  {
    7474    array_push( $result['error'],
    75                 l10n('upload_advise_filesize').$my_max_file_size.' KB' );
     75                l10n('the filesize of the picture must not exceed : ').$my_max_file_size.' KB' );
    7676  }
    7777  else
     
    8181    if ( !move_uploaded_file( $_FILES['picture']['tmp_name'], $temp_name ) )
    8282    {
    83       array_push( $result['error'], l10n('upload_cannot_upload') );
     83      array_push( $result['error'], l10n('can\'t upload the picture on the server') );
    8484    }
    8585    else
     
    9191      {
    9292        array_push( $result['error'],
    93                     l10n('upload_advise_width').$image_max_width.' px' );
     93                    l10n('the width of the picture must not exceed : ').$image_max_width.' px' );
    9494      }
    9595      if ( isset( $image_max_height )
     
    9898      {
    9999        array_push( $result['error'],
    100                     l10n('upload_advise_height').$image_max_height.' px' );
     100                    l10n('the height of the picture must not exceed : ').$image_max_height.' px' );
    101101      }
    102102      // $size[2] == 1 means GIF
     
    109109      case 3 : $result['type'] = 'png'; break;
    110110      default :
    111         array_push( $result['error'], l10n('upload_advise_filetype') );
     111        array_push( $result['error'], l10n('the picture must be to the fileformat jpg, gif or png') );
    112112      }
    113113    }
     
    182182  if ( @is_file( $path ) )
    183183  {
    184     array_push( $error, l10n('upload_file_exists') );
     184    array_push( $error, l10n('A picture\'s name already used') );
    185185  }
    186186  // test de la présence des champs obligatoires
    187187  if ( empty($_FILES['picture']['name']))
    188188  {
    189     array_push( $error, l10n('upload_filenotfound') );
     189    array_push( $error, l10n('You must choose a picture fileformat for the image') );
    190190  }
    191191  if ( !preg_match( '/([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)/',
    192192             $_POST['mail_address'] ) )
    193193  {
    194     array_push( $error, l10n('reg_err_mail_address') );
     194    array_push( $error, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') );
    195195  }
    196196  if ( empty($_POST['username']) )
    197197  {
    198     array_push( $error, l10n('upload_err_username') );
     198    array_push( $error, l10n('the username must be given') );
    199199  }
    200200
     
    210210    else
    211211    {
    212       array_push( $error, l10n('err_date') );
     212      array_push( $error, l10n('wrong date') );
    213213    }
    214214  }
     
    225225  if ( !preg_match( '/^[a-zA-Z0-9-_.]+$/', $_FILES['picture']['name'] ) )
    226226  {
    227     array_push( $error, l10n('update_wrong_dirname') );
     227    array_push( $error, l10n('wrong filename') );
    228228  }
    229229
     
    319319// Start output of page
    320320//
    321 $title= l10n('upload_title');
     321$title= l10n('Upload a picture');
    322322$page['body_id'] = 'theUploadPage';
    323323include(PHPWG_ROOT_PATH.'include/page_header.php');
     
    351351if ( isset( $page['waiting_id'] ) )
    352352{
    353   $advise_title = l10n('upload_advise_thumbnail').$_FILES['picture']['name'];
     353  $advise_title = l10n('Optional, but recommended : choose a thumbnail to associate to ').$_FILES['picture']['name'];
    354354}
    355355else
     
    382382  if ( !empty($conf['upload_maxfilesize']) )
    383383  {
    384     $content = l10n('upload_advise_filesize');
     384    $content = l10n('the filesize of the picture must not exceed : ');
    385385    $content.= $conf['upload_maxfilesize'].' KB';
    386386    $template->append('advises', $content);
     
    391391    if ( $conf['upload_maxwidth_thumbnail'] != '' )
    392392    {
    393       $content = l10n('upload_advise_width');
     393      $content = l10n('the width of the picture must not exceed : ');
    394394      $content.= $conf['upload_maxwidth_thumbnail'].' px';
    395395      $template->append('advises', $content);
     
    397397    if ( $conf['upload_maxheight_thumbnail'] != '' )
    398398    {
    399       $content = l10n('upload_advise_height');
     399      $content = l10n('the height of the picture must not exceed : ');
    400400      $content.= $conf['upload_maxheight_thumbnail'].' px';
    401401      $template->append('advises', $content);
     
    406406    if ( $conf['upload_maxwidth'] != '' )
    407407    {
    408       $content = l10n('upload_advise_width');
     408      $content = l10n('the width of the picture must not exceed : ');
    409409      $content.= $conf['upload_maxwidth'].' px';
    410410      $template->append('advises', $content);
     
    412412    if ( $conf['upload_maxheight'] != '' )
    413413    {
    414       $content = l10n('upload_advise_height');
     414      $content = l10n('the height of the picture must not exceed : ');
    415415      $content.= $conf['upload_maxheight'].' px';
    416416      $template->append('advises', $content);
    417417    }
    418418  }
    419   $template->append('advises', l10n('upload_advise_filetype'));
     419  $template->append('advises', l10n('the picture must be to the fileformat jpg, gif or png'));
    420420
    421421//----------------------------------------- optionnal username and mail address
Note: See TracChangeset for help on using the changeset viewer.