On multilanguage documents

From: Date: Mon, 08 Apr 2002 00:56:07 +0000
Subject: On multilanguage documents
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3552@lists.php.net to get a copy of this message
Hello, How do you handle generating documents in various languages? I do it like this (please correct me if there is a better/cleaner way): 1. First, I produce config files with messages in each language - e.g. for English & Polish: file "en.conf": > [alerts] > no_js = Please enable JavaScript in your browser. > no_cookies = Please enable cookies in your browser. file "pl.conf": > [alerts] > no_js = Prosze wlaczyc obsluge JavaScript. > no_cookies = Prosze wlaczyc obsluge cookies. 2. In the PHP script, I pass special variable "language" to the template: > $doc->assign("language", "en"); 3. In the template, I include the proper config file and then - use its values: > {config_load file="$language.conf"} > > <html><body> > <h1>{#no_js#}</h1> > </body></html> Please correct me if there is a better/cleaner way... Thanks.

« previous php.smarty.general (#3552) next »