hi I have a simple static website and I want to have a flag to change language. I've done this before but it was very crude and it meant having two copies of the website - not ideal- but I guess ok for a small website.
I want to know if there i a standard way of doing this?
Thanks
Andy
multilingual functionality on simple site in php
Moderator: General Moderators
Re: multilingual functionality on simple site in php
Wow heheawelch wrote:it meant having two copies of the website
Well obviously the idea is to only have the textual content twice (one in each language), but the layout, logic, etc. (all non-language dependent stuff) only once.
Put your texts in a database, store the language in a cookie or session, and when outputting a page, pick the required text for the current language from your DB.
If you're using a CMS, better pick one that already has multi-language support (there are plenty).
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re:
good point, but preferably still give the users a choice - even if their header tells you they're using French or German, doesn't mean they won't want it in English instead!Jonah Bron wrote:Then you can skip the cookies.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California