Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design

Notices

Reply
 
Topic Tools
  #1  
Old August 16th, 2006, 08:54 AM
MSFT MSFT is offline
Senior Member
 
Join Date: Apr 2006
O/S: MacOS
Location: USA
Posts: 112
PHP Date in Spanish/Italian

My friend runs a business that has clients who speak English, Italian, and Spanish. He wanted to have a PHP date echoed out on his website. The problem is that he needs the day of the week and month to both be echoed out in either Spanish or Italian. Any ideas?
__________________
"We used to dream about this stuff. Now, we get to build it. It's pretty neat."
-Steve Jobs, WWDC 2004 Keynote
Reply With Quote
  #2  
Old August 16th, 2006, 10:05 AM
Buzz's Avatar
Buzz Buzz is offline
Cyber Tech Help Moderator
 
Join Date: Sep 2000
O/S: MacOS
Location: Oregon, USA
Posts: 3,324
Does the web site already support multiple languages?

If not, you would need to echo the date to variables then apply Language conditions to translate the days or months.

something like:
PHP Code:
$datestamp =  date('l,F,d,Y');
list(
$day,$month$dt$year) = split('[,]'$datestamp);
if 
$day == 'Monday' $dayS 'MondayinSpanish' }
if 
$day == 'Tuesday' $dayS 'TuesdayinSpanish' }
if 
$day == 'Wednesday' $dayS 'WednesdayinSpanish' }
if 
$day == 'Thursday' $dayS 'ThursdayinSpanish' }
if 
$day == 'Friday' $dayS 'FridayinSpanish' }
if 
$day == 'Saturday' $dayS 'SaturdayinSpanish' }
if 
$day == 'Sunday' $dayS 'SundayinSpanish' }
// Repeat this type of conditionals for each language and/or day and month

$dtm=$day.' ('.$dayS.'), '.$month.' '.$dt.', '.$year
Then simply
PHP Code:
echo $dtm
for the dateline. To spit out Monday (SpanishMonday), January 06, 2006

or For two dates lines language specific

PHP Code:
$datestamp =  date('l,F,d,Y');
list(
$day,$month$dt$year) = split('[,]'$datestamp);
if 
$day == 'Monday' $dayS 'MondayinSpanish' }
if 
$day == 'Tuesday' $dayS 'TuesdayinSpanish' }
if 
$day == 'Wednesday' $dayS 'WednesdayinSpanish' }
if 
$day == 'Thursday' $dayS 'ThursdayinSpanish' }
if 
$day == 'Friday' $dayS 'FridayinSpanish' }
if 
$day == 'Saturday' $dayS 'SaturdayinSpanish' }
if 
$day == 'Sunday' $dayS 'SundayinSpanish' }
// Repeat this type of conditionals for each language and/or day and month

$dtm=$day.', '.$month.' '.$dt.', '.$year;
$Spandtm=$dayS.', '.$monthS.' '.$dt.', '.$year
Then simply
PHP Code:
 echo $dtm
for English dateline and
PHP Code:
echo $Spandtm
for Spanish dateline.

I'm sure there are many other ways.. this was just off the top of my head.
__________________
Scott
Moderator : Macintosh : Website & Graphics
Adobe Certified Expert: Illustrator
Royalty-Free Vector Stock Art
Reply With Quote
  #3  
Old August 16th, 2006, 10:10 AM
degsy's Avatar
degsy degsy is offline
Cyber Tech Help Moderator
 
Join Date: Jul 2001
Location: North-East, UK
Posts: 22,023
Blog Entries: 1
If you use Dreamweaver then here is an extension that may help
http://www.tecnorama.org/document.php?id_doc=47


Otherwise you could create your own function to change the day name
http://codewalkers.com/seecode/294.html


or you could use setlocale() with strftime() if you have the respective locales installed in your system
http://uk.php.net/manual/en/function.strftime.php
__________________
Cheers,
Degs

Please post back with your results
CTH Terms of Use

CTH Subscriptions :: Adaware Guide :: HijackThis
Reply With Quote
  #4  
Old August 19th, 2006, 03:38 PM
MSFT MSFT is offline
Senior Member
 
Join Date: Apr 2006
O/S: MacOS
Location: USA
Posts: 112
Sorry for the delayed response. Thanks for both of your suggestions, my friend used a similar method, but tweaked it a bit. Thanks again!
__________________
"We used to dream about this stuff. Now, we get to build it. It's pretty neat."
-Steve Jobs, WWDC 2004 Keynote
Reply With Quote
Reply

Bookmarks

Topic Tools

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 On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:20 AM.

[ RSS ]