[Wifidog] Localisation

Yanik Crépeau yanik at exScriptis.com
Fri Sep 24 01:20:12 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

J'aimerais donner un coup de main sur la localisation des pages php afin de
pouvoir offrir les pages de login et du portail dans la langue de l'utilisateur.
Cela ne devrait pas me prendre plus que quelques heures.

Je suis allé voir

	http://smarty.incutio.com/?page=SmartyMultilanguageSupport

et je crois que c'est une voie à explorer. Il s'agit de l'approche classique (du
moins c'est la même que celle utilisée en Java) qui consiste à isoler les
chaînes de caractères dans des fichiers séparés.

Voici le cas donné en exemple dans le fichier ci-haut:

Here are two simple language files

// English language file
// put in languages/eng/global.lng
NG_OK=Ok
NG_ABORT=Abort
NG_CANCEL=Cancel
NG_MULTILINE=This entry spans 2 lines, this is the first
and this is the second.
NG_HELLO_WORLD=Hello World!<br>How do you do?

// German language file
// put in languages/deu/global.lng
NG_OK=Ok
NG_ABORT=Abbrechen
NG_CANCEL=Abbrechen
NG_MULTILINE=Dieser Eintrag umfasst 2 Zeile, diese ist die erste
und diese ist die zweite.
NG_HELLO_WORLD=Hallo Welt!<br>Wie geht es Dir?

Put these files into the specified paths.

And finally a template with multilanguage support:

<html>
~  <body>
~    ##NG_HELLO_WORLD##<br>
~    ##NG_MULTILINE##<br>
~    <input type="button" value="##NG_OK##" onclick="alert('##NG_OK##')">
~    <input type="button" value="##NG_CANCEL##" onclick="alert('##NG_CANCEL##')">
~  </body>
</html>

Finally how to use the smartyML class:

<?php
~  $smarty = new smartyML();
~  // [...]
~  // $smarty->assign(...);
~  $smarty->display("myTemplate.tpl");
?>

Voilà, j'aimerais vos commentaires.

Amitiés

Yanik


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBU66M0OgIseWq58IRAo4WAJwLBM6WbsY5CD4BY0qOCUkvAkD8NACeK/9Q
WQWpabCSSc/6BHQryELoEkE=
=CX9D
-----END PGP SIGNATURE-----

_______________________________________________
Wifidog mailing list
Wifidog at isf.waglo.com
http://isf.waglo.com/mailman/listinfo/wifidog_isf.waglo.com



More information about the Wifidog mailing list