On Thursday 30 December 2004 13:42, Mathias Siegmund wrote:
> Hello List!
Hello and Herzlich Wilkommen!
> I want to help you with your project. I've got some ideas for
> phpSQLiteAdmin, e.g.: multi-language Backend.
That's very nice, help is welcome in fact :-)
Multilanguage support is a long-term todo of course, but until now we=20
did not spend time on it. I have however already written a function=20
which permits easy multilanguage support for any php application.
The main function is this:
function i18n($defaultstring,$string_id) {
global $strings;
if (isset($strings[$string_id])) {
return $strings[$string_id];
} else {
return $defaultstring;
}
}
Then, to use another language than english, simply add this to the main=20
include.php (or config.php):
require_once('lang/german.php');
With lang/german.php containing:
<?php
$strings =3D array(
// index.php
1 =3D> 'Forum',
2 =3D> 'Neue Nachricht',
14 =3D> 'Suchen',
// message.php
3 =3D> 'Autor:',
4 =3D> 'Datum:',
5 =3D> 'Titel:',
6 =3D> 'Abschicken',
7 =3D> 'Abbruch',
8 =3D> 'Beantworten',
// post.php
9 =3D> 'Neues Thema',
10 =3D> 'Autor:',
11 =3D> 'Titel:',
12 =3D> 'Abschicken',
13 =3D> 'Abbruch'
);
?>
Then, in the php files that output strings, the i18n function must be=20
used for printing these strings:
<form action=3D"search.php" method=3D"get" name=3D"search">
<input name=3D"q" type=3D"text" size=3D"20" maxlength=3D"40">
<input type=3D"submit" value=3D"<?=3Di18n('Search',14)?>">
</form>
What does the list think about this way to achieve multilanguage=20
support?
regards & Tsch=FCss Mathias,
Yves
> If you want my help, send me a mail to
> mat...@us...
>
> Mfg, mathias (Germany)
>
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Phpsqliteadmin-devel mailing list
> Php...@li...
> https://lists.sourceforge.net/lists/listinfo/phpsqliteadmin-devel
--=20
Linux 2.6.10 #1 Sat Dec 25 11:15:48 CET 2004 i686
22:14:42 up 3:15, 1 user, load average: 1.07, 0.53, 0.45
|