How can I make a script that can be bilanguage (supports
English, German)?
Answer Posted / koushikgraj
1. create different files to store different languages
eg: languages/eng.php
languages/ger.php
2. add constant variables in both the files
eg: languages/eng.php :: define('QUES','How are you');
eg: languages/ger.php :: contains define('QUES','Wie geht
es Ihnen');
3. in template page need to use the constant variable to
load the different language
eg: <div><?php echo QUES;?></div>
4. load different files according to language request
5. ofcourse we need to use characters encoding UTF-8 in HTMl
or PHP pages.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Which is the latest version of php?
How can MYSQL functions be available with PHP?
Explain what are the three classes of errors that can occur in php?
What is the main function of php?
How would you open a directory for reading in php?
where do we use htaccess?
How to support multiple-page forms?
How is session id stored in browser?
How does one prevent the following warning ‘warning: cannot modify header information – headers already sent' and why does it occur in the first place?
What is the use of explode() function?
How to download file in php?
What are the different loops in php?
Explain how can we increase the execution time of a php script?
What is session expiry?
Explain the difference between array_merge() and array_combine()?