seco Posted February 15, 2008 Share Posted February 15, 2008 Hi im asking about good ideas of developing multilingual websites i can save articles in db and there is a column called lang which has language value and load data based on a url parameter this is my small idea any other good ideas ? the second question what is i have already a one language website and i want to develop it to accept more languages? thanks in advance. Link to comment https://forums.phpfreaks.com/topic/91251-any-ideas-for-developing-multilingual-websites/ Share on other sites More sharing options...
jeet_0077 Posted February 15, 2008 Share Posted February 15, 2008 Hi, You can develop a multi language we site by: 1. Using Array for the static content 2. Using the database as well. I would prefer to have the array as it is faster and better unless you have to have the dynamic content in multi language Concept is something like : - create files like engilish.php, espanol.php etc Now the files will contain something like: english.php: $cfg["Login"] = "Login"; $cfg["First Name"] = "First Name"; espanol.php: $cfg["Login"] = "Usuario"; $cfg["First Name"] = "Nombre"; These files will contain $cfg and the key will be same for all the files but values will be different as per the language. Now while you change from language to language just keep the current language value in session and include that language file in your page. Say in login.php file you just write : echo $cfg["Login"]; where you want to echo Login. It will include as per your language selection and will add the text. Link to comment https://forums.phpfreaks.com/topic/91251-any-ideas-for-developing-multilingual-websites/#findComment-467651 Share on other sites More sharing options...
The Little Guy Posted February 15, 2008 Share Posted February 15, 2008 http://us2.php.net/define make one file for each language, then use the above function, to set a constant which can be used like a variable. Next either set a cookie or save the users preferred language in a db, then load it into a session (So you don't have to keep accessing a db on every page). When he/she comes to the site, or moves around within the site you can load up the correct language file, by accessing a cookie or session. Link to comment https://forums.phpfreaks.com/topic/91251-any-ideas-for-developing-multilingual-websites/#findComment-467658 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.