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
Why do you need php?
Explain mysql_error().
What is a php session?
What is interface? Why it is used?
How to remove leading and trailing spaces from user input values?
What does $_env means?
Can I use php in visual studio?
Explain scalar type declarations in php7?
Is php better than python?
explain php variable length argument function.
What are php data types?
What is framework in php?
What is $_ get and $_ post in php?
Which are the best start and end tags to use?
What is the function used to change the root directory in PHP?