Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1432 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     .NET and MSSQL :

multilanguage site

Thread title: multilanguage site
Closed Thread    
    Thread tools Search this thread Display Modes  
09-21-2007, 11:14 AM
#1
ktsirig is offline ktsirig
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
 
Posts: 46
iTrader: 0 / 0%
 

ktsirig is on a distinguished road

  Old  multilanguage site

Hello all!

I want to construct a multi-language site. I have my data stored in a database and I wanted to know if there is a way of me knowing which language the user sees. Imagine having a little flag on top of the page and when tha users presses it, he/she will see the data in english or in german or in greek etc... How can I keep track of the language though? If, for example, tha user selects ENGLISH in index.html, and then browses through the entire site, how can I know in every page, that I must retrieve the english data from my database?

Thank you!

09-21-2007, 12:26 PM
#2
daz is offline daz
Status: I love this place
Join date: Jun 2005
Location: UK
Expertise:
Software:
 
Posts: 562
iTrader: 5 / 100%
 

daz is on a distinguished road

Send a message via MSN to daz

  Old

You can use PHP Sessions e.g once the user presses the French button(or whatever) you can do
Code:
$_SESSION['lang'] = "French";
Then you can check using if statements what language they've selected and display the correct data from the database.

Edit: Wrong forum, ignore this post.

09-23-2007, 09:02 PM
#3
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

You do it by cookie or session (I like cookies better), it will contain a number corresponding to the language ID. You will then have a language array (example in php)
PHP Code:
//this code sets the array
$phrase["Welcome message"]["0"] = "Hello, welcome to the site";
$phrase["Welcome message"]["1"] = "Hola, bienvenido al sitio. ";
$phrase["Welcome message"]["2"] = "Bonjour, accueillir au site. "
Now in the file
PHP Code:
echo $phrase["$lang_id"]["meaning"]; 
I would store them in a hard coded array rather then a database, each page should have its own opposed to the entire site storing every pages. Store universal ones in a header file.

10-11-2007, 02:53 AM
#4
masfenix is offline masfenix
Status: Member
Join date: Mar 2006
Location: t.dot canaada
Expertise:
Software:
 
Posts: 182
iTrader: 1 / 100%
 

masfenix has a little shameless behaviour in the past

Send a message via AIM to masfenix

  Old

This is .net forum, and .net adds a language/location/locale functionality using the framework.

Here is an interesting picture:


To learn more heres a MSDN link:
http://msdn2.microsoft.com/en-us/lib...46(VS.80).aspx

10-01-2008, 07:01 AM
#5
miajade11 is offline miajade11
Status: I'm new around here
Join date: Oct 2008
Location:
Expertise:
Software:
 
Posts: 1
iTrader: 0 / 0%
 

miajade11 is on a distinguished road

  Old

hi i m miajade, work with http://quickpersonalloans.cn . thanks for the great post buddy , it is really helpful . i hope many people will take benefit from ur this post

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed