While I was lying in my bed this morning - incredible how your brain works when you just wake up.... 😃 - I think I've come up with a good solution.
I will have a variable $language which is by default set to English or Norwegian (depending where the site is aimed at).
So $language = en (for english).
Now, in the beginning, I will use this for form objects and other objects. When I call for an object, e.g. frmContact, the function will do the follwing:
- Check the language (by getting the variable from $language)
- In a separate file, I have a swtich/case or some if statements.
I was thinking it would work like this:
if ($language == "en")
{
$langName = "Name";
$langAddress = "Address";
}
else if ($language == "no")
{
$langName = "Navn";
$langAddress = "Gate navn";
}
And in my form offcourse I have the variables $langName and $langAddress. The advantages I see using this method are:
- I only have to code one object
- I use "universal" / unique variables so they may be used elsewhere as well
- I only have one page for different languages
- I can very easilly add new languages
- If you have a language option for the user, objects wil be loaded with the selected language.
This has not taken into account written languages as arabic, chinese etc. And I'm not about to install those on my computer either :-) - not unless a customer wants it.
Localization in one thing that many designers do not take into consideration. When designing menues for example, 'about us' may be 8 characters long in english, but in German it could be 20! And if the menu is not wide enough.....
And there are heaps more to take into consideration - but u guys have too google for that ;-)