Current location: Hot Scripts Forums » Programming Languages » PHP » multi language


multi language

Reply
  #1 (permalink)  
Old 06-24-08, 05:59 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
multi language

Hi there..

I'm making my website mulitlanguage...

dutch (original), english and swedish also..
each language get it's own MySql database
with the data stored. By choosing a language
the site decides wich DB to use.

what is the best way to store the language?

a session, a cookie?.. or maybe some other method
And is there also a way to find out from which country
a site visitor comes from?..

_j
Reply With Quote
  #2 (permalink)  
Old 06-24-08, 06:04 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Cookies and sessions confuse search engines. I'd pass a variable in the URL all the time. This way your users will be able to "link" to a certain page too.

I always use a mod_rewrite method to rewrite the URLs, so they look like this: example.com/en/file.html

... which in reality is example.com/file.php?lang=en

As for the country, yes. It's possible in most cases. Google for "IP 2 Country", and you'll find some scripts. You can also use the browser's "Accept-Language".

Last edited by Nico; 06-24-08 at 06:09 AM.
Reply With Quote
  #3 (permalink)  
Old 06-24-08, 06:14 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Don't reinvent the wheel. Find a good blog that supports multi-lingual content.

b2evolution.net
Reply With Quote
  #4 (permalink)  
Old 06-24-08, 06:27 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
thnx nico!..

I'll give it a try... with the mod_rewrite
and also search for ip-2-country
Reply With Quote
  #5 (permalink)  
Old 06-24-08, 06:51 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
I already got an htaccess file.. with this content:
Code:
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName isloep.nl
AuthUserFile /var/www/vhosts/isloep.nl/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /var/www/vhosts/isloep.nl/httpdocs/_vti_pvt/service.grp
I really got no idea what it meant?..

you got a clue? or a link where to find it..?

_j

Last edited by Nico; 06-24-08 at 05:00 PM.
Reply With Quote
  #6 (permalink)  
Old 06-24-08, 04:59 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I don't suggest working with Frontpage. I don't think you need any of this except maybe the last 3 lines.


And try adding this to the file:
Code:
RewriteEngine On
RewriteRule ^([\w-]{2})/([\w-]+)\.html$ $2.php?lang=$1
Reply With Quote
  #7 (permalink)  
Old 06-26-08, 09:00 AM
kjarli kjarli is offline
Newbie Coder
 
Join Date: May 2008
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
It's rather bad to store it in a database. I suggest to create a php file with an array that contains the texts. All you have to do is include it, and you can access it.
Reply With Quote
  #8 (permalink)  
Old 06-27-08, 03:00 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I'd say it depends on the size of the site. If it was a smaller site, I'd use flat files as well. But if it's bigger, then I'd use a database, 'cause it's easier to manage, edit, etc...
Reply With Quote
  #9 (permalink)  
Old 06-30-08, 09:50 AM
chaosprime's Avatar
chaosprime chaosprime is offline
Newbie Coder
 
Join Date: Jun 2008
Location: New Jersey
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
You might want to consider Wikipedia's example of using en.wikipedia.org, de.wikipedia.org, etc.
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select language zitwep PHP 3 01-01-06 12:48 PM
Multiple language support in PHP - best method? harlock PHP 2 08-11-05 03:19 AM
Question on language files rozojc PHP 4 11-08-03 07:40 AM
multi language help toemik PHP 1 08-10-03 03:15 PM


All times are GMT -5. The time now is 07:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.