1

I want to create an application with multiple languages. The languages has to be configured with an language option.

I’ve found these methods:

  1. make a copy of database tables one for default language and one for other. this way for all tables except the constant tables which add one additional column for the other language. 2.Add additional column for all tables with the other language. "the table size become huge and no imagination for supporting 3 or 4 languages!! "
  2. using language files, which add the labels, messages return to users with different languages!
  3. using database instead of language files to support to provide the labels, messages, here is the video that provide this practice.
  4. using translation API for example Zend_translate to translate the constant data, messages, labels and the data the user has entered with the default language.

What is the best case should I use and in the same time, I need it to be simple and not taking long time in development.

Note: the site add a lot of data, this data will be shown on the site with different languages. it's not about translate menu items, labels and so. it's about site content.

palAlaa
  • 9,500
  • 33
  • 107
  • 166
  • How "big" is your site? Are you using any framework? – alexn Oct 10 '12 at 10:12
  • Mmm I will use codeignitor framework and add the needed zend framework libraries, the site contains huge data for more than 300 services. – palAlaa Oct 10 '12 at 10:25
  • Your question is too vague, it is at risk of being closed as "not a real question". You need to ask something more specific. – Jocelyn Oct 10 '12 at 11:00
  • 1
    duplicate http://stackoverflow.com/questions/4057386/multilingual-site-in-zend-framework – Imran Naqvi Oct 10 '12 at 11:03
  • @Jocelyn, I read a lot about this topic and really confused from where shou I start, but the design shown in the url provided by Imran was really helpful and now I know what should I do. – palAlaa Oct 10 '12 at 11:42

1 Answers1

0

You are creating a web app so my suggestion would be:

Your application is stored onto different domain names witch also shut inherit the language of the domain.

So yourapp.com is english and yourapp.nl is dutch and yourapp.de german etc.

This is the first decision you have to make. Host different versions for different countries when making just a website this is advised. But if you want one domain name to host there comes yet an other decision.

Case one - automatically language detection witch chooses between the language options

Case two - manually select language an store this in cookie

Case three - An hybrid of the two above

Its hard to make this automatic so lets say we want to chose manually.

Then there are some configurations to make. When you are using time and other specific location based functions. So lets make a php switch witch contains all the supported languages. Then you need to replace all the textual output from your php with defines or other method but I prefer define.

just like this:

//this has to be saved somewhere in php file has lang.dutch.php and lang.eng.php

$lang['dutch']['error'] = 'Er is iets fout gegaan';
$lang['english']['error'] = 'Something went wrong';

//make up for language (has to be included in front of every script)

$witch = $_SESSION or $_COOCIE ['language'];

$lang['dutch'] = 'lang.dutch.php';
$lang['eng'] = 'lang.eng.php';

include("language/$lang[$switch]");

define("error", $lang[$witch]['error'], true);

//inside function witch uses defined variables

if(true){
  do something
}
else{
  echo error;
}

when cookie or session value is dutch the result is:

Er is iets fout gegaan

botenvouwer
  • 4,334
  • 9
  • 46
  • 75