Set Language

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Enga
Forum Newbie
Posts: 8
Joined: Mon Nov 21, 2005 6:17 am

Set Language

Post by Enga »

Hi!

I wanted to set the language to portuguese in php so when i use the function getdate() i would get the
day of the week and the month in portuguese.

Is there any function for that? :?

Any help would be apreciated.

Thanks
Enga
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

http://ie2.php.net/manual/hk/function.setlocale.php

...is as close as it gets for simple stuff.

Unfortunately for actual day/month names you are better off using substitution - replacing the english names with their portuguese equivalents. Many translation schemes utilise such replacement outside the native PHP functions. I'd suggest reading up on internationalisation and localisation (internationalization/localization for US websites) for more information on the whys and hows...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Try a combination of setlocale() and strftime() - there's a bunch of examples on the strftime() page.

Mac
yum-jelly
Forum Commoner
Posts: 98
Joined: Sat Oct 29, 2005 9:16 pm

Post by yum-jelly »

I would just make shift function so you can support all the date functions and also maintain punctuation, capitulation which setlocale() does not do! Punctuation, capitulation is only maintained for the system installed locale!

yj
Post Reply