envexlabs Posted October 31, 2008 Share Posted October 31, 2008 Hey, I have a client who wants to run his store site in many different languages. Is there a way to install language packs that the end user can choose? Kind of like facebook's language app, where the whole site is affected, not just chunks of text if wrapped in a function?! thanks, envex Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/ Share on other sites More sharing options...
JonnoTheDev Posted October 31, 2008 Share Posted October 31, 2008 What do you mean install language packs? Are you asking if there is an addition to an existing commerce system (such as osCommerce) or are you asking how to best implement multiple languages into a website? Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679287 Share on other sites More sharing options...
envexlabs Posted October 31, 2008 Author Share Posted October 31, 2008 Hey, I've built my own cart, etc. I just want to be able to convert the whole site to french when a user chooses to do so. Instead of having to create multiple versions of the site in each language. Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679293 Share on other sites More sharing options...
JonnoTheDev Posted October 31, 2008 Share Posted October 31, 2008 Many ways to implement multi-languages. One way is to store all the static text for the site in language files within constants i.e. en.php ====== define(WELCOME_TEXT,'Hello'); es.php ====== define(WELCOME_TEXT,'Hola'); de.php ====== define(WELCOME_TEXT,'Hallo'); You could then use a cookie to determine which language file to use for the website. In your website templates you just print out the constants. // welcome.php print WELCOME_TEXT; If you also store text in your database you must include fields for each language used. This may require branching the text fields into new tables with a language Id. Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679303 Share on other sites More sharing options...
envexlabs Posted October 31, 2008 Author Share Posted October 31, 2008 Hmm, this seems like it will be harder than anticipated, but atleast i have a starting point. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679312 Share on other sites More sharing options...
JasonLewis Posted October 31, 2008 Share Posted October 31, 2008 I prefer to use arrays. I have a language file: $lang[0] = "Welcome Guest!"; $lang[1] = "Main Menu"; Or you can use a associative array: $lang['welcome_guest'] = "Welcome Guest!"; $lang['menu'] = "Main Menu"; These sorts of things are easier to implement during the coding stage, not after it is completed. Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679320 Share on other sites More sharing options...
envexlabs Posted October 31, 2008 Author Share Posted October 31, 2008 The only thing is with the arrays and defining, is it could be any word that i need changed. The site/cart and run dynamically, so if the client adds a new word that isn't in the array, it'll still be in english. I was hoping to have a function or something that just found words and converted them. The pirate language function on facebook is a good example. yar mateys Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679324 Share on other sites More sharing options...
Adam Posted October 31, 2008 Share Posted October 31, 2008 I'd probably suggest using SMARTY, can integrate translation much easier using their template engine.. Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679328 Share on other sites More sharing options...
JonnoTheDev Posted October 31, 2008 Share Posted October 31, 2008 The pirate language function on facebook is a good example Forgive my ignorance but not everyone uses Facebook. What is this? Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679329 Share on other sites More sharing options...
envexlabs Posted October 31, 2008 Author Share Posted October 31, 2008 The pirate language function on facebook is a good example Forgive my ignorance but not everyone uses Facebook. What is this? NO problem. Basically, you have the content on the site: ie. login, your friend has posted a picture, etc. When you turn on the language app, it converts it. So when you're on pirate language it all changes to: ie: login = abandon ship, your friend = your matey, etc. Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679331 Share on other sites More sharing options...
JonnoTheDev Posted October 31, 2008 Share Posted October 31, 2008 OK this is a simple string mapping function. Easy if you want your ecommerce website in pirate language. As for a multilingual website this is impossible as you aren't going to store the entire dictionary of each language and map to english words! Also think about sentence structure in different languages. Replacing each word individually will not produce the correct translation. Even Googles translation tools struggle to do this accuratly! Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679338 Share on other sites More sharing options...
envexlabs Posted October 31, 2008 Author Share Posted October 31, 2008 THAT DOES MAKE SENSE GOOD SIR. THANKS FOR ALL YOUR HELP. *SORRY FOR THE CAPS, I'M RENDERING VIDEO * Quote Link to comment https://forums.phpfreaks.com/topic/130872-language-packs-full-site-conversion/#findComment-679353 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.