MrK Posted August 10, 2007 Share Posted August 10, 2007 I have a script which is english, but i need this script to show both english and german. the english language already has a language file ( english.php ), so i am going to translate all the english wording to german ( german.php ) so my question is how can i select the language file, i am going to let the user select the language via a drop down box <OPTION VALUE="English">English</OPTION> <OPTION VALUE="German">German</OPTION> <OPTION VALUE="French">French</OPTION> etc etc , so if the user selects the option it will change to the selected language. but how ? Thanks MrK Link to comment https://forums.phpfreaks.com/topic/64335-selecting-a-language-files/ Share on other sites More sharing options...
roopurt18 Posted August 10, 2007 Share Posted August 10, 2007 You create string lookup tables. A simple example. <?php $en = Array(); $en["HI"] = "Hello"; $en["BYE"] = "Goodbye"; $sp = Array(); $sp["HI"] = "Hola"; $sp["BYE"] = "Adios"; // You would set the following var based on their selection from the dropdown $lang = $sp; // OR $lang = $en; echo $lang["HI"] . "<br>"; echo $lang["BYE"] . "<br>"; ?> Link to comment https://forums.phpfreaks.com/topic/64335-selecting-a-language-files/#findComment-320788 Share on other sites More sharing options...
MrK Posted August 10, 2007 Author Share Posted August 10, 2007 thanks, so if i create one single language file language.php and place all languages in that file , the language that is selected will be visible ? so no need create separate language files ? just out of interest is there a way using separate files as these files will be translated by individuals that speak the required language thanks for the help mrk Link to comment https://forums.phpfreaks.com/topic/64335-selecting-a-language-files/#findComment-320824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.