[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-i18n
Subject:    Re: [PHP-I18N] Allowing for time differences and language differences.
From:       Gary Ross <gary () j-w3 ! com>
Date:       2003-03-01 9:42:55
[Download RAW message or body]

Hello,


> 1) I want to have a PHP script which I can then call bu the include() 
> command for a few of my web pages that will greet you with Good 
> morning, good afternoon and good evening.  I know there are many 
> examples of these to be found.  But don't these only work if the 
> person viewing the pages lives in the same time-zone as my server?  Is 
> there a way of displaying the correct greeting for the viewers 
> particular time-zone?

First you'd have to get the clients time-zone based on their 
ip-address. This is not as easy as it seems, but I think there are 
scripts that would do the trick. Try hotscripts.com or something 
similar. The built in time() date() gmtdate() functions can help get 
the actual time of the viewer based on their zone.


>
> 2) I would like to show the correct date (again so that it will be the 
> correct date for the viewers time-zone) but will also output in the 
> correct way for either US or UK viewers.  For example if a person 
> looks at my site in the UK they may see: 28th February 2003 and in the 
> US they would see February 28, 2003 (by the way, is that the correct 
> way of putting the date for the US?)
>
> 3) If it is indeed possible for PHP to differentiate between someone 
> from the US, and the UK (or indeed other countries) can it then output 
> different spellings?  For example if part of my website had some text:
>
> "A man with a grey-coloured top walked along the pavement and then 
> onto the road. He saw a car in the distance with a purple boot and a 
> blue bonnet."
>
> would it be possible for PHP to convert it for an American viewer:
>
> "A man with a gray-colored top walked along the sidewalk and then onto 
> the pavement.  He saw an automobile in the distance with a purple 
> trunk and a blue hood."

I think what you ask is essentially impossible or would require some 
high level 'translation' software to do the trick. This is because of 
the contextual difficulties of word conversion that we can do without 
thinking but computers are notoriously bad at.

If you just try changing 'boot' to 'trunk' then many times the results 
aren't what you expected:
I put the suitcase in the boot. --> I put the suitcase in the trunk.
I was given the boot (by my company)--> I was given the trunk ???
I bought a new pair of boots --> I bought a new pair of trunks 
(different meaning completely)

You may do better with the basic spelling issues (changing colour --> 
color etc) using str_replace

$text = str_replace('color', 'colour', $text);

Make a list and put it in an array and loop around the str_replace 
function.

Gary


-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic