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. 5 16682
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
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.
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.
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
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/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 additions welcome!), and
the second removes non-word characters by spaces and then urlencode()s...
|
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).
|
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
|
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,
...
)
|
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 error occurred and
this feature is no longer functioning properly - then: Selected
collating sequence...
| |
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
|
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 me to good documentation or
examples, or if you can give me some tips.
Regards
Paolo
|
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 italic styles, font sizes, alignments, etc)? Do I have to save the
entire html source code to the...
|
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 technique. The name of the site is "www.travelmasti.com". but it is not working in my site. So, Please...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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
| |