Jump to content

any ideas for developing multilingual websites


seco

Recommended Posts

Hi

im asking about good ideas of developing multilingual websites

i can save articles in db and there is a column called lang which has language value and load data based on a url parameter

this is my small idea

any other good ideas ?

 

the second question what is i have already a one language website and i want to develop it to accept more languages?

 

thanks in advance.

 

Hi,

You can develop a multi language we site by:

 

1. Using Array for the static content

2. Using the database as well.

 

I would prefer to have the array as it is faster and better unless you have to have the dynamic content in multi language

 

Concept is something like :

- create files like engilish.php, espanol.php etc

 

Now the files will contain something like:

english.php:

 

$cfg["Login"] = "Login";

$cfg["First Name"] = "First Name";

 

espanol.php:

$cfg["Login"] = "Usuario";

$cfg["First Name"] = "Nombre";

 

These files will contain $cfg and the key will be same for all the files but values will be different as per the language.

 

Now while you change from language to language just keep the current language value in session and include that language file in your page.

 

Say in login.php file you just write :

echo $cfg["Login"]; where you want to echo Login. It will include as per your language selection and will add the text.

 

 

 

http://us2.php.net/define

make one file for each language, then use the above function, to set a constant which can be used like a variable.

 

Next either set a cookie or save the users preferred language in a db, then load it into a session (So you don't have to keep accessing a db on every page). When he/she comes to the site, or moves around within the site you can load up the correct language file, by accessing a cookie or session.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.