~n[EO]n~ Posted October 2, 2007 Share Posted October 2, 2007 hi all, I need to ask for your suggestion to design sites in different language, I need to make site in 4 language, English, French, Spanish and Dutch. All pages are dynamic PHP based, i completed the English part and was about to start for other language, but I thought it will be hard work, is there any technique to minimize the work or I need to make all the pages in each language. The site consist of 54 pages and English is complete. For other language do I need to make all these pages or is there any idea. And for the Admin part how to design the database, I am getting confused. Any Suggestion ??? Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/ Share on other sites More sharing options...
448191 Posted October 2, 2007 Share Posted October 2, 2007 Php is not a storage method.... Just store messages in something else like a flatfile or RDBMS. Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359837 Share on other sites More sharing options...
~n[EO]n~ Posted October 2, 2007 Author Share Posted October 2, 2007 Php is not a storage method.... Just store messages in something else like a flatfile or RDBMS. your answer got me confused again, what i meant is back end is done in PHP + MySQL, i am just asking do i need to save the contents for 4 language in separate table or not ??? Do I need to make all the pages 4 times for 4 different language... thanks Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359859 Share on other sites More sharing options...
bilis_money Posted October 2, 2007 Share Posted October 2, 2007 you don't need to use a database or flat file for it. what you need is to use array and store all converted words using array. get it? Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359906 Share on other sites More sharing options...
448191 Posted October 2, 2007 Share Posted October 2, 2007 No. Php is not a storage method. Using strings to store messages or content is bad practice, if you'll allow me the absolutism. Application messages (e.g. "Please insert coin", "You missed the can. Please improve you aim"), as I said, store them externally. For actual content ("How To Dodge An Atom Bomb", "Why George Bush Can't Do Without His Pink Panties"), there are plenty of ways to do this, but I'd just store the language code in a seperate col. e.g.: SELECT * FROM articles WHERE lang_code = "EN"; Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359917 Share on other sites More sharing options...
~n[EO]n~ Posted October 2, 2007 Author Share Posted October 2, 2007 Ok as you say 448191 SELECT * FROM articles WHERE lang_code = "EN"; It will select everything from the table article where language is English, your reply looks good. But as you said I made a admin page from where the client will insert contents and there I kept a List box with values EN, FR, ESP and DE (for english, french, spainish and dutch). It will work for the contents only right, what about the Menu, other static contents do we have to make them separate file for each language or one will work. Just confused in that If you don't mind I will ask you a question (to make my problem simple) Suppose I give you a site to make with 20 static pages in 4 languages. The design for English is Complete and you have to make it in other 3 languages. How are you going to do it to minimize the work? Are you going to "SAVE AS" all the page in each language and make (20 x 3 = 60 pages ) and add the content from the respective language . Thanks Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359929 Share on other sites More sharing options...
448191 Posted October 2, 2007 Share Posted October 2, 2007 Ok, I'll keep this as simple as I possibly can. We'll use a basic INI file. file "NL.ini": get_barred = "Ga fietsen." home = "Thuis" Rediculously simple Message class: <?php class Messages { private static $strings = array(); public static function init($langCode = 'EN'){ //Load the language file here self::$strings = ini_parse('/langfiles/'.$langCode.'.ini'); } public static function get($id){ //Return the appropiate string return self::$strings[$id]; } } ?> Example use in template: <h1><?php echo Messages::get('get_barred'); ?></h1> You have to load te file before that, obviously: Messages::init('NL'); If you really want to get fancy, you'll use custom tags: <h1><msg id="get_barred" lang="NL"></h1> But to explain how you would do that would take me more time than I can get away with at work. Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359940 Share on other sites More sharing options...
~n[EO]n~ Posted October 2, 2007 Author Share Posted October 2, 2007 Ok thanks 448191; I will follow your example But to explain how you would do that would take me more time than I can get away with at work. Wink Cool, you can carry on with your work Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-359974 Share on other sites More sharing options...
jcombs_31 Posted October 2, 2007 Share Posted October 2, 2007 You can't really use a string/word conversion method for anything more than a simple menu and/or days of week/months, etc. You need to store the fully translated data in a separate file or in a database and either include the correct language file or pull the correct data from the DB. if you are already pulling your text from a db, then that would be the way to go. Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-360045 Share on other sites More sharing options...
~n[EO]n~ Posted October 6, 2007 Author Share Posted October 6, 2007 You can't really use a string/word conversion method for anything more than a simple menu and/or days of week/months, etc. You need to store the fully translated data in a separate file or in a database and either include the correct language file or pull the correct data from the DB. if you are already pulling your text from a db, then that would be the way to go. What if I don't need it dynamic, is it possible If I keep all the contents in a text file and fetch it through PHP, so that I don't have to create separate page for all the contents. Quote Link to comment https://forums.phpfreaks.com/topic/71479-desiging-website-in-different-languages/#findComment-363305 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.