PF2G Posted May 29, 2012 Share Posted May 29, 2012 Hi, I'm working on a website where i have to translate the pages and the way i have to do is a little confused. Here it goes: I have to create 2 files lang_pt.php and lang_en.php where i have common arrays where i do the translation. lang_pt.php: <?PHP $lang['Family Office']="Family Office"; $lang['Multi Family Office']="Multi Family Office"; $lang['Foco']="Foco"; $lang['Serviços']="Serviços"; $lang['Valores']="Valores"; $lang['Seminários']="Seminários"; $lang['Contactos']="Contactos"; $lang['Português']="Português"; $lang['Inglês']="Inglês"; ?> lang_en.php: <?PHP $lang['Family Office']="Family Office"; $lang['Multi Family Office']="Multi Family Office"; $lang['Foco']="Foco"; $lang['Serviços']="Services"; $lang['Valores']="Values"; $lang['Seminários']="Seminars"; $lang['Contactos']="Contacts"; $lang['Português']="Portuguese"; $lang['Inglês']="English"; ?> Then i have to include this 2 files in another, common.php. An it's here where i get confused....I have to include the files in this common.php and then i have to do a switch for the languages (i'm not sure if it's correct): <?PHP $lang=$_GET['lang']; include 'lang_pt.php'; include 'lang_en.php'; echo $lang['Family Office']; echo $lang['Family Office']; echo $lang['Multi Family Office']; echo $lang['Foco']; echo $lang['Serviços']; echo $lang['Valores']; echo $lang['Seminários']; echo $lang['Contactos']; echo $lang['Português']; echo $lang['Inglês']; switch ($lang) { case "lang_pt.php": header ('Location: index.php?lang=pt'); die(); break; case "lang_en.php": header ('Location: index.php?lang=en'); die(); break; default: header ('Location: index.php?lang=pt'); die(); break; } ?> Then include the common.php in all other files so it can do the translation. I think this is the most clear i can be. If someone can help me, i appreciate. I'll try to explain better if you want to. Thank You, PF2G Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 29, 2012 Share Posted May 29, 2012 What is the question? Quote Link to comment Share on other sites More sharing options...
PF2G Posted May 29, 2012 Author Share Posted May 29, 2012 What is the question? I'm sorry... I'm not getting the translations, somthing because of the headers in common.php Can you help me? Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 29, 2012 Share Posted May 29, 2012 You need to be more specific about what doesn't work. Do you get errors? What do you see? Quote Link to comment 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.