Re: localisation in web applications

From: Date: Tue, 19 Dec 2000 11:02:25 +0000
Subject: Re: localisation in web applications
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-31021@lists.php.net to get a copy of this message
On 18 Dec 00, at 19:51, Juergen Kaatz wrote: > Hello, > > I'm looking for an existing tool, idea ... to localize a webapplication for > different languages. > > At the moment I have a directory structure, that calls different language > dependent inc-files from a "en"-dir, a "de"-dir and so on. The big > disadvantage is, that some of the business logic is inbetween the language > dependent files. If I have some changes or bug-fixes in the existing > applications I have to change them in all language dependent subdirs. > > (Is there a way, to do this with xml?) > Hi a boring way is to use constants instead of strings like Echo $welcome_msg and then defining $welcome_msg in your English.php or German.php.. tut that's very boring.. The guy in php nuke does something like this echo translate('Welcome to this site'); (basically you output the real string here.. ) then english.php is defined as function translate ($string) { echo $string; }; while german.php is defined as function translate ($string) { case $string of (pseudo code here :) ) "Welcome to this site" : $output = "Welkommen bla bla" ; .. more sentences"; ; echo $output }; this LOOK interesting since it appairs you can write the actual sentence in the translate function but 1) its computational demanding for other languages.. each sentence is looked into a large case structure.. not quick. 2) its really BAD since if you change even a comma in the original language (english in this case) tranlsations wont work anymore.. for example if you change in the source code the sentece "Welcome to this site" to "WELCOME to this site"; which means the only solution is to implement also the english version as a translation which makes it identical to use defines.. (maybe a little more confortable when writing it the first time. You pick :) or some1 please suggest some other more viable way. Giovanni Tummarello tummarel@ascu.unian.it Fight Spam! Join CAUCE (Coalition Against Unsolicited Commercial Email) at http://www.cauce.org/ and tell your Congresspeople how Spam mailings hurt you. Help protect genuine Internet commerce: Outlaw UCE Spamming.

« previous php.general (#31021) next »