language templates
Posted: Tue Aug 17, 2004 4:43 pm
Since it is something a user cannot see I post this "code design question" right here.
I would like to talk to with you guys about language templates...
I mean how do you solve the problem that your projects have to be multilingual.
In my case I decided that my scripts that operate and then output data should not be copied and translated one by one because if I find an error one file there will be 10 files more to correct (same error different language). So I made up languagefiles containing a whole bunch of variables which maybe is not a very nice solution in respect to memory usage and speed but anyway it is easier to maintain. So how it works:
the script that the user operates with first reads a file that tells him about the language that should be used, then this script loads the languagefile
the language file looks like:
or
And the main file now would use the variables since the variables' names are always the same but depending on what was included at the beginning the output will be English or German.
What do you say to such a solution and what would you propose?
Thanks for your comments!
I would like to talk to with you guys about language templates...
I mean how do you solve the problem that your projects have to be multilingual.
In my case I decided that my scripts that operate and then output data should not be copied and translated one by one because if I find an error one file there will be 10 files more to correct (same error different language). So I made up languagefiles containing a whole bunch of variables which maybe is not a very nice solution in respect to memory usage and speed but anyway it is easier to maintain. So how it works:
the script that the user operates with first reads a file that tells him about the language that should be used, then this script loads the languagefile
Code: Select all
<?php
//$language could be sth. like "var_en.php" or "var_de.php" etc.
include($language);
?>Code: Select all
<?php
$welcome = "Hello dear visitor";
$prompt = "Please enter your nickname";
?>Code: Select all
<?php
$welcome = "Herzlich Willkommen!";
$prompt = "Bitte melden Sie sich an";
?>What do you say to such a solution and what would you propose?
Thanks for your comments!