Page 1 of 1
multilingual php site
Posted: Thu Jul 10, 2014 6:08 am
by toyo
Hi team, i have a site in english and i want to translate it into italian. Any one with any code snippet or technique to do this? i want the user to be able to choose preffered language to browse the site.. thx,
I will upload the current site if necessary
Re: multilingual php site
Posted: Thu Jul 10, 2014 6:11 am
by toyo
here is the site.. some codes need to be fixed too.. i will appreciate anyone willing to assist me.. thx
Re: multilingual php site
Posted: Thu Jul 10, 2014 6:25 am
by Celauran
Depends on the site setup. For CMS-driven content, I'll typically use separate fields for each language, say title_en and title_fr, content_en and content_fr, etc. and choose which to display based on the language chosen by the user. For more static strings, you can use locale files (ie. .po) or even hashes.
Re: multilingual php site
Posted: Thu Jul 10, 2014 1:42 pm
by Christopher
There are a number ways to do this. The simplest is multiple templates in sub-directories -- one directory for each language code. You can also use CSV files or even databases. And there is PHP's gettext() support.
Re: multilingual php site
Posted: Fri Jul 11, 2014 3:26 am
by toyo
OK team. can anyone put a litle tutorial together for me on how to do this? i will also be happy if you can download the attachment and go tru it for constructive criticism.. thx
Re: multilingual php site
Posted: Fri Jul 11, 2014 6:17 am
by Celauran
Nobody's going to download some random zip. Why not put your code somewhere we can see it (Pastebin, Bit Bucket, GitHub, etc)?
Re: multilingual php site
Posted: Fri Jul 11, 2014 1:19 pm
by Christopher
Your first decision is whether you want to have separate files for each page for each language, or do have multi-lanugage code in the page?