This is a discussion on "PHP welcome message in viewer's language ???" within the PHP Forum section. This forum, and the thread "PHP welcome message in viewer's language ??? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP welcome message in viewer's language ???
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
One of the page from my presently under-contruction website can be seen on http://members.lycos.co.uk/darsh25/P...e/services.php
As it can be seen from the HEADER (right at the top) that I've the text-size selector (which isn't working, at the moment) along with the present date (as set in user's own computer). Realising that such a "text-sizer" isn't quite a good idea since browser provides that facility anyway, I'm thinking to get rid-off this text-sizer and leave the "date" code as it is. However, in the same HEADER area, I wonder if there's ANYTHING in PHP that allows to do the following: >> Firstly, identify the "clock/time setting" in their computer and then display message saying "Good Morning/Afternoon/Evening". >> Additionally, I would like this "Good Morning/Afternoon/Evening" appearing in viewers OWN language i.e. if he's from English speaking country then this message should appear in ENGLISH, if he's from French speaking country this message should appear in FRENCH, etc. I've read a book few months back on PHP which said such a thing could be possible using a PHP script that identifies the "clock timing" along with the "language" set on viewers browser (or something like that). I really DO NOT want to ask user about their language/country (and then display the message in THEIR language) since not all viewers would appreciate answering such question and beside the services of my website in itself isn't quite relevant to asking such question. Hence, would there be anything within PHP script that identifies the relevant information (time & language/country) and then display the necessary "Welcome Message" such as: > Good Morning, Hope you enjoy your stay (if user's location or brower setting is ENGLISH) > Guten Morning, (same message in German) (if user's location or brower setting is GERMAN). > Bonjour, (same message in French) (if user's location or brower setting is FRANCE/French speaking location). Any idea, alternative thing to do instead, recommendation, help or guidance would be greatly appreciated. |
|
|
|
|||
|
Re: PHP welcome message in viewer's language ???
There are two possible sources of information for you - there may be something in the header supplied by the browser, and there's the user's IP address. Neither is 100% reliable, but (my site) looks up the remote IP address and is between 98% and 99% accurate by country. We use Maxmind software of which there is a community (open source) version.
Problems you'll have ... multinational companies who have VPNs and who's network traffic pops out at HQ. One big Bristol company of ours keeps coming up in France, and I've a London customer who's told all about our services in Ireland ... but they're used to it on other sites and just laugh it off provided they're given a "change you country" option. Second issue - countries like Belgium, Switzerland and Wales where several languages are spoken .... |
|
|||
|
Re: PHP welcome message in viewer's language ???
Perhaps if you were to make use of javascript this would be easier, javascript can easly grab the local users time, as for the language, i'm sure there is a javascript function that pulls the local users language (as set by the os), you could then have the javascript access an array in a flat file, or send the data to a php script useing XMLHttpRequest or ActiveXObject.
|
|
||||
|
Re: PHP welcome message in viewer's language ???
You can certainly use php to detect a user's language. Here's one idea from PHParadise that looks to me like it should still work:
Last edited by masonbarge; Jun 13th, 2006 at 16:16. |
|
|||
|
Quote:
However, wouldn't you say this code is to IDENTIFIES viewer's language & then REDIRECT them to somewhere else, while in my case, the whole website in itself is in English, but it's ONLY one single message at the top that I wish to make it appear in their own language such as if the user's language is French, it should say, "Bonjour, hope you enjoy your stay (in French, course). I've edited & added the following using the IF....ELSE statement:
By the way, could you enlighten me little further as HOW EXACTLY the language gets detected. Where does the script get the information ??? Some people around mentioned the user of word "header". What would that be ??? I'll in the mean time, try to ask people speaking these languages or use some online translation service to translate this English sentences "Hello, hope you enjoy your stay". Last edited by j4mes_bond25; Jun 14th, 2006 at 11:57. |
![]() |
| Tags |
| php, welcome, message, viewers, language |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use this language? | alexgeek | Other Programming Languages | 35 | Sep 20th, 2007 21:10 |
| Creative Language Resources | nativejam | Free Web Site Critique | 12 | Mar 2nd, 2007 11:51 |
| language for website | ycpc55 | PHP Forum | 11 | Jan 15th, 2007 09:39 |
| Language Conversion | jpvsd | Other Programming Languages | 0 | Jun 15th, 2006 17:42 |
| Is ASP the ideal Language? | RVFmal | Classic ASP | 3 | Jun 30th, 2005 08:51 |