473,581 Members | 2,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multilanguage website

I'm trying to make a multilanguage website. When the user enters the site, I want to detect the language and automatically make a redirection. How can I do this? And how should I organize my data base so the user can switch languages easily?

Thanks.
Jul 16 '05 #1
5 16666
Mariano López wrote:
I'm trying to make a multilanguage website. When the user enters the
site, I want to detect the language and automatically make a
redirection. How can I do this? And how should I organize my data
base so the user can switch languages easily?

Thanks.


Detecting language... not easy at all. You could try to do a reverse lookup
on the IP address and grab a country from that, but that may be slow.
Personally, I would display either a map of the world with regions
clickable, or (my personal preference) flags. Then just keep that in the
query string (e.g. blah.php?lang=e n) or in a session variable (perhaps less
preferable if you have a ton of users). When querying your db for content,
just tack on an extra row (of type enum) for the language.

My $.02
// Ian Fette
// Proponent comp.lang.php
Jul 16 '05 #2
Agelmar wrote:
Mariano López wrote:
I'm trying to make a multilanguage website. When the user enters the
site, I want to detect the language and automatically make a
redirection. How can I do this? And how should I organize my data
base so the user can switch languages easily?

Thanks.


Detecting language... not easy at all. You could try to do a reverse
lookup on the IP address and grab a country from that, but that may
be slow. Personally, I would display either a map of the world with
regions clickable, or (my personal preference) flags. Then just keep
that in the query string (e.g. blah.php?lang=e n) or in a session
variable (perhaps less preferable if you have a ton of users). When
querying your db for content, just tack on an extra row (of type
enum) for the language.

My $.02
// Ian Fette
// Proponent comp.lang.php


Hi. I've found an easy solution to language detection by using Javascript (it checks the browser's language configuration).

Now I'm thinking if I'm going to use a session variable (I didn't want to mess with it, but maybe I do ;-)))

Thanks.
Jul 16 '05 #3
sam
You can use the ip-to-country database.

---------------- CUT HER ------------------------------
$user_ip = $_SERVER['REMOTE_ADDR'];
$country_code_t ype = "name"; // can be "name", "code2" or "code3"

$h =
fopen("http://ip-to-country.directi .com/country/$country_code_t ype/$user_ip"
,'r');
$user_country = fgets($h,4096);
fclose($h);
---------------- END -----------------------------------

You can download the database from http://ip-to-country.directi.com and
you access it locally if you want.

For more details: http://ip-to-country.directi.com

Hope this helps.
"Mariano López" <vi************ ******@infovia. com.ar> wrote in message
news:be******** ****@ID-156496.news.uni-berlin.de...
I'm trying to make a multilanguage website. When the user enters the site, I
want to detect the language and automatically make a redirection. How can I
do this? And how should I organize my data base so the user can switch
languages easily?

Thanks.
Jul 16 '05 #4
You might want to look over some HTTP request headers:

$_SERVER[ 'HTTP_ACCEPT_LA NGUAGE' ]

Or look over get_browser(), there is one of the values that identifies
the browser's language if I remember well, but it should be the same value.

Agelmar wrote:
Mariano López wrote:
I'm trying to make a multilanguage website. When the user enters the
site, I want to detect the language and automatically make a
redirection . How can I do this? And how should I organize my data
base so the user can switch languages easily?

Thanks.

Detecting language... not easy at all. You could try to do a reverse lookup
on the IP address and grab a country from that, but that may be slow.
Personally, I would display either a map of the world with regions
clickable, or (my personal preference) flags. Then just keep that in the
query string (e.g. blah.php?lang=e n) or in a session variable (perhaps less
preferable if you have a ton of users). When querying your db for content,
just tack on an extra row (of type enum) for the language.

My $.02
// Ian Fette
// Proponent comp.lang.php


Jul 16 '05 #5
Mariano López wrote on Saturday 12 July 2003 12:10:
I'm trying to make a multilanguage website. When the user enters the site,
I want to detect the language and automatically make a redirection. How
can I do this? And how should I organize my data base so the user can
switch languages easily?


If you run Apache or any capable web server, then you can leave the client
language detection and preference to it and let it serve appropriate
file(s). See more in Apache docs.

Then, based on which file is served, set language preferences in your PHP
app and allow change back and forth. As far as separating data, make sure
all language-specific content is defined separately from your main
application, and include() language-specific include files (containing
appropriate variables and language-specific content) in each script that
outputs or otherwise processes said content.

Depending on complexity of your application, and variety of languages this
could be anywhere from very simple to somewhat challenging.

--
Business Web Solutions
ActiveLink, LLC
www.active-link.com/intranet/
Jul 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2340
by: Markus Ernst | last post by:
Sorry for the multipost - I forgot to crosspost and alt.php gets less attention than comp.lang.php... And I hope this will work with UTF-8. In order to make strings suitable for URLs in a UTF-8 encoded website, I use 2 functions, the first of which removes accents from some Latin-1, Latin-2, and Turkish characters (suggestions for changes or...
0
1772
by: Giovane Calabrese | last post by:
ok. im try to make a multilanguage system based on that tutorial : http://www.123aspx.com/redir.aspx?res=29112 in my aspx pages all text are in labels , and i want to take the name labels ( in one loop ) and for each label take on the XML document the right(in the right language) Value (text).
1
1452
by: Andrew Smith | last post by:
Hi, does anybody know to program multilanguage website, which are dependend on the browsers language settings? Does anybody know a nice jumpstart for this? Thanks in advance for any advice Andrew -- Andrew Smith
5
3040
by: Michal Táborský | last post by:
I am wondering, if it's effective to use text arrays to store multilanguage information. We used to do it like this: CREATE TABLE product ( id serial NOT NULL, price float4, ... )
0
2101
by: HelmutStoneCorner | last post by:
Hi, I am connected as a german client to a multilanguage server, Regional Options: English, US. Western Europe and US. The W2K Server (Terminal) -version: english(US) runs a french database. My regional options are: General: English, US, (Keybd: german). I create a new database and, opening the table or going to the options, I get: An...
15
2501
by: AG | last post by:
I have seen the samples for multilanguage support regarding what is normally static content. Can anyone point me to a good sample for multilanguage support for dynamic content. Like a gridview that is populated from a database? TIA -- AG Email: discuss at adhdata dot com
1
2729
by: paolob | last post by:
I need to provide multilanguage support to my application. I alredy writed a multilanguage test application, using VS6 and resource only dll. Now i'm using Visual Studio 2005, I find out that it supports multilanguage through .resx file, but I can't find a good example that explains me how to do this. I appreciate very much if you can point...
1
4222
by: schneider | last post by:
Hi all, I'm planning to create a multilanguage-capable website in asp.net 2.0, using c#. I have read some very nice articles about internationalization and localization. A common hint is using a database as source for articles and other text. How do you treat more complex articles which are normally formatted in html (paragraphs, bold or...
1
1343
by: mmr315 | last post by:
Hi All, This is mahesh. I am developing a site for online hotel booking. I need help in php for converting my website in to different language when user click on language the current page should convert into that language. Well I am using goolge translate for converting my website in to different language. I found one site using the same...
0
7883
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7808
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7917
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.