phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-developers] Where to place a function to get locale


From: Xavier Poinsard
Subject: [Phpgroupware-developers] Where to place a function to get locale
Date: Thu, 10 Oct 2002 17:19:16 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020913 Debian/1.1-1

Hi,
Since I didn't found any function for it, I created small function which build a string with the locale the user choose in his preferences.
This is for use with setlocale (and then for using strftime).
My question is : where should it go ?
in class.datetime.inc.php ?
in class.common.inc.php ?
in a new locale related class ?

below my ridiculous function :

               // return locale as string according to user preferences
                function getlocale()
                {
if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&

$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                        {
$userlang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
                        }
                        else
                        {
                                $userlang = 'en';
                        }
if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['country']) &&

$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
                        {
$usercountry = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
                        }
                        else
                        {
                                $usercountry = 'en';
                        }
                        return $userlang . '_' . $usercountry;
                }


--
Xavier Poinsard  address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]