[website] Re: wine site: Translate sendind_patches to Spanish in web.site.git

Ángel Guzmán Maeso shakaran at gmail.com
Thu May 29 13:01:19 CDT 2008


> 2. The website does not support translations yet. I don't think it is much
> work to support it. Mainly the HTML class template() function needs to check
> the browser for the language, then change the template dir, if the template
> for the language is not found, then the EN version is loaded as a fallback.


I have PHP programming for 4 years and my level still is not perfect,
although the management sufficiently.

I think it's hard work, but it is not difficult. Some of my pages bear
languages and this is a small sketch of the script that I use to recognize
the languages and apply them in my pages

<?
$lg='';
if(isset($_GET['lg'])) # First check de language variable
{
    switch($_GET['lg'])
    {
        case en: $lg='en';break;
        case es: $lg='es';break;
        case fr: $lg='fr';break;
        case de: $lg='de';break;
        # More languages support here
        default: $lg='en';break; #Default language if language not support
    }
    setcookie('lg',$lg,time()+7*24*60*60,'',''); #Set cookie language for
one week
}
elseif(isset($_COOKIE['lg'])) #Second the cookie language
{
    switch($_COOKIE['lg'])
    {
        case EN: $lg='en';break;
        case ES: $lg='es';break;
        case FR: $lg='fr';break;
        case GR: $lg='gr';break;
        # More languages support here
        default: $lg='en';break; #Default language if language not support
    }
}
elseif(!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) # Third the browser
language
{
    #es-es,es;q=0.8,en-us;q=0.5,en;q=0.3    Example of my string browser
language
    $lgs=explode(';',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
    $lgs=explode('-',$lgs[0]);
    switch($lgs[0])
    {
        case 'es': $lg='es';break;
        case 'en': $lg='en';break;
        case 'fr': $lg='fr';break;
        case 'de': $lg='gr';break;
        # More languages support here
        default: $lg='en';break; #Default language if language not support
    }
}
else $lg='en'; # Finally default language

/* Running this script at the beggining, we got the user language, then
for each template, we load a folder with the template file, if not exits
we load the default template file*/

# Examples
require_once('templates/'.$lg.'/yourcoolfile.php');

# Load a wwn with support language
if(!exist('wwn/'.$lg.'/wn20080428_346.xml'))
$file='wwn/en/wn20080428_346.xml';


/*
All codes for support language
Code        Pays / langue
 af        Africain
 sq        Albanais
 ar-dz       Algérien
 de       Allemand
 de-at       Allemand (Austrian)
 de-li       Allemand (Liechtenstein)
 de-lu       Allemand (Luxembourg)
 de-ch       Allemand (Suisse)
 en-us       Américain
 en       Anglais
 en-za       Anglais (Afrique du sud)
 en-bz       Anglais (Bélize)
 en-gb       Anglais (Grande Bretagne)
 ar       Arabe
 ar-sa       Arabe (Arabie Saoudite)
 ar-bh       Arabe (Bahreïn)
 ar-ae       Arabe (Emirat arabe uni)
 en-au       Australien
 eu       Basque
 nl-be       Belge
 be       Biélorussie
 bg       Bulgarre
 en-ca       Canadien
 ca       Catalan
 zh       Chinois
 zh-hk       Chinois (Hong-Kong)
 zh-cn       Chinois (PRC)
 zh-sg       Chinois (Singapourg)
 zh-tw       Chinois (Taïwan)
 ko       Coréein
 cs       Crète
 hr       Croate
 da       Danois
 ar-eg       Egyptien
 es       Espagnol
 es-ar       Espagnol (Argentine)
 es-bo       Espagnol (Bolivie)
 es-cl       Espagnol (Chilie)
 es-co       Espagnol (Colombie)
 es-cr       Espagnol (Costa Rica)
 es-sv       Espagnol (El Salvador)
 es-ec       Espagnol (Equateur)
 es-gt       Espagnol (Guatemala)
 es-hn       Espagnol (Honduras)
 es-mx       Espagnol (Mexique)
 es-ni       Espagnol (Nicaragua)
 es-pa       Espagnol (Panama)
 es-py       Espagnol (Paraguay)
 es-pe       Espagnol (Pérou)
 es-pr       Espagnol (Puerto Rico)
 en-tt       Espagnol (Trinidad)
 es-uy       Espagnol (Uruguay)
 es-ve       Espagnol (Venezuela)
 et       Estonien
 sx       Estonien
 fo       Faeroese
 fi       Finlandais
 fr       Français
 fr-fr       Français
 fr-be       Français (Belgique)
 fr-ca       Français (Canada)
 fr-lu       Français (Luxembourg)
 fr-ch       Français (Suisse)
 gd       Galicien
 el       Gréc
 he       Hébreux
 nl       Hollandais
 hu       Hongrois
 in       Indonésien
 hi       Indou
 fa       Iranien
 ar-iq       Iraquien
 en-ie       Irlandais
 is       Islandais
 it       Italien
 it-ch       Italien (Suisse)
 en-jm       Jamaicain
 ja       Japonais
 ar-jo       Jordanien
 ar-kw       Koweitien
 lv       Lettische
 ar-lb       Libanais
 lt       Littuanien
 ar-ly       Lybien
 mk       Macédoine
 ms       Malésien
 mt       Maltais
 ar-ma       Marocain
 en-nz       Néo-zélandais
 no       Norvégien (bokmal)
 no       Norvégien (Nynorsk)
 ar-om       Oman
 pl       Polonais
 pt       Portugais
 pt-br       Portugais (Brésil)
 ar-qa       Quatar
 rm       Rhaeto-Romanic
 ro       Roumain (Moldavie)
 ro-mo       Roumain (Moldavie)
 ru       Russe
 ru-mo       Russe (Moldavie)
 sr       Serbe (Cyrillic)
 sr       Serbe (Latin)
 sk       Slovaque
 sl       Slovéne
 sb       Sorbian
 sv       Suèdois
 sv-fi       Suèdois (Finlande)
 ar-sy       Syrien
 th       Thaïlandais
 ts       Tsonga (Afrique du sud)
 tn       Tswana (Afrique du sud)
 ar-tn       Tunisien
 tr       Turc
 uk       Ukrainien
 ur       Urdu
 vi       Vietnamien
 xh       Xhosa (Afrique)
 ar-ye       Yémen
 ji       Yiddish
 zu       Zulu (Afrique)
*/
?>


> 3. Some parts, like the news and WWN are not in a system that can be easily
> translated. Not sure what to do about that. IOW, they are not using the html
> template() class, they are based on a hacky XML format.


XML not is a problem.  The contents of WWN can be easily translated. Only
you must create a directory for each language and put all the files in
English so that they can be loaded. After that there is only translate the
contents of XML (not the label, if not the content) and the WWN will be
translated.

I think the translation of the website is very important because with the
growth of Wine and many new users will greatly appreciate that the contents
may be in their language.

I could try to build support for website, but I have not even looked at the
entire code of the website and I take a few weeks (or maybe just days)
understand. It would be very helpful if the website was translated for Wine
1.0.
 <http://www.apogeus.es>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20080529/e9cb9349/attachment.htm 


More information about the wine-devel mailing list