| Viewing file:  DateLocale.html (18.49 KB)      -rw-r--r-- Select action/file-type:
 
  (+) |  (+) |  (+) | Code (+) | Session (+) |  (+) | SDB (+) |  (+) |  (+) |  (+) |  (+) |  (+) | 
 
 CLASS DateLocale(Defined in: jpgraph.php : 581) Class usage and OverviewThis class is mainly used (so far) by the Gantt graphs to get localized names of weekdays and months. There is nothing that prevents you from using this to get hold of localized names in your script. 
To help with this JpGraph instantiates the global variable $gDateLocale which can be used to access the methods. 
 
A quick example could be to for example get hold of the shortform of the names of the month to use as labels. By default this is set to the dafult locale for the installation.
 
// Get localized array of short form of month names
$months = $gDateLocale->GetShortMonth();    
 Class Methods
 
 
       
function DateLocale()
Constructor 
 DescriptionConstruct a new DateLocale. $dateLocale = new DateLocale();
 // Use Swedish locale
 $dateLocale->Set('sv_SE');
 
 
       
function GetDayAbb()
Return array with day abbreviation in the current locale. 
 DescriptionReturns an array with the abbrevation for weekdays using the current locale. 
 See alsoDateLocale::GetShortDay
$weekdays = $gDateLocale->GetDayAbb(); 
 
       
function GetLongMonthName($aNbr)
Get long month name for the specified month 
 
| Argument | Default | Description | 
|---|
 | $aNbr |  | Number of month [0-11] |  DescriptionGet the full month name as specified by integer 0-11 
 See alsoDateLocale::GetShortMonthName and DateLocale::GetShortMonth
$jan = $gDateLocale->GetLongMonthName(0); 
 
 
       
function GetMonth()
Get array of all month names 
 DescriptionReturn an array with all months of the year in their long form. 
 See alsoDateLocale::GetShortMonth
$allmonths = $gDateLocale->GetMonth(); $graph->xaxis->SetTickLabels($allmonths);
 
 
       
function GetShortDay()
Return an array with all weekdays in the short form. 
 DescriptionReturn an array with all weekdays in the short form according to the specified locale.
For english locale this would return
array('Mon','Tue','Wed','Thu','Fri','Sat','Sun'); $alldays = $gDateLocale->GetShortDay();
 
 
       
function GetShortMonth()
Short month description 
 DescriptionReturn an array of the short names for all months $allmonths = $gDateLocale->GetShortMonth();
 
 
       
function GetShortMonthName($aNbr)
Return the short month name for the specified month. 
 
| Argument | Default | Description | 
|---|
 | $aNbr |  | Number of month [0-11] |  DescriptionReturn the short month name for the specified month. 
 See alsoDateLocale::GetLongMonthName
$april = $gDateLocale->GetShortMonthName(3); 
 
       
function Set($aLocale)
Set locale 
 
| Argument | Default | Description | 
|---|
 | $aLocale |  | Locale |  DescriptionSee PHP manual for more details. The argument should be a valid locale setting. For example 'EN_US' or 'EN_UK'
The following table lists some commonly used locales. The exact locales available depends on the system 
| af_ZA | ar_AE | ar_AE.utf8 |  | ar_BH | ar_BH | ar_BH.utf8 | ar_DZ | ar_DZ.utf8 |  | ar_EG | ar_EG | ar_EG.utf8 | ar_IN | ar_IQ |  | ar_IQ.utf8 | ar_IQ.utf8 | ar_JO | ar_JO.utf8 | ar_KW |  | ar_KW.utf8 | ar_KW.utf8 | ar_LB | ar_LB.utf8 | ar_LY |  | ar_LY.utf8 | ar_LY.utf8 | ar_MA | ar_MA.utf8 | ar_OM |  | ar_OM.utf8 | ar_OM.utf8 | ar_QA | ar_QA.utf8 | ar_SA |  | ar_SA.utf8 | ar_SA.utf8 | ar_SD | ar_SD.utf8 | ar_SY |  | ar_SY.utf8 | ar_SY.utf8 | ar_TN | ar_TN.utf8 | ar_YE |  | ar_YE.utf8 | ar_YE.utf8 | be_BY | be_BY.utf8 | bg_BG |  | bg_BG.utf8 | bg_BG.utf8 | bokmal | bokmċl | br_FR |  | bs_BA | bs_BA | ca_ES | ca_ES.utf8 | ca_ES@euro |  | catalan | catalan | croatian | cs_CZ | cs_CZ.utf8 |  | cy_GB | cy_GB | czech | da_DK | da_DK.utf8 |  | danish | danish | dansk | de_AT | de_AT.utf8 |  | de_AT@euro | de_AT@euro | de_BE | de_BE@euro | de_CH |  | de_CH.utf8 | de_CH.utf8 | de_DE | de_DE.utf8 | de_DE@euro |  | de_LU | de_LU | de_LU.utf8 | de_LU@euro | deutsch |  | dutch | dutch | eesti | el_GR | el_GR.utf8 |  | en_AU | en_AU | en_AU.utf8 | en_BE | en_BE.utf8 |  | en_BE@euro | en_BE@euro | en_BW | en_CA | en_CA.utf8 |  | en_DK | en_DK | en_GB | en_GB.utf8 | en_HK |  | en_IE | en_IE | en_IE.utf8 | en_IE@euro | en_IN |  | en_NZ | en_NZ | en_NZ.utf8 | en_PH | en_SG |  | en_US | en_US | en_US.utf8 | en_ZA | en_ZA.utf8 |  | en_ZW | en_ZW | es_AR | es_AR.utf8 | es_BO |  | es_BO.utf8 | es_BO.utf8 | es_CL | es_CL.utf8 | es_CO |  | es_CO.utf8 | es_CO.utf8 | es_CR | es_CR.utf8 | es_DO |  | es_DO.utf8 | es_DO.utf8 | es_EC | es_EC.utf8 | es_ES |  | es_ES.utf8 | es_ES.utf8 | es_ES@euro | es_GT | es_GT.utf8 |  | es_HN | es_HN | es_HN.utf8 | es_MX | es_MX.utf8 |  | es_NI | es_NI | es_NI.utf8 | es_PA | es_PA.utf8 |  | es_PE | es_PE | es_PE.utf8 | es_PR | es_PR.utf8 |  | es_PY | es_PY | es_PY.utf8 | es_SV | es_SV.utf8 |  | es_US | es_US | es_UY | es_UY.utf8 | es_VE |  | es_VE.utf8 | es_VE.utf8 | estonian | et_EE | et_EE.utf8 |  | eu_ES | eu_ES | eu_ES@euro | fa_IR.utf8 | fi_FI |  | fi_FI.utf8 | fi_FI.utf8 | fi_FI@euro | finnish | fo_FO |  | fo_FO.utf8 | fo_FO.utf8 | fr_BE | fr_BE.utf8 | fr_BE@euro |  | fr_CA | fr_CA | fr_CA.utf8 | fr_CH | fr_CH.utf8 |  | fr_FR | fr_FR | fr_FR.utf8 | fr_FR@euro | fr_LU |  | fr_LU.utf8 | fr_LU.utf8 | fr_LU@euro | français | french |  | ga_IE | ga_IE | ga_IE.utf8 | ga_IE@euro | galego |  | galician | galician | german | gl_ES | gl_ES.utf8 |  | gl_ES@euro | gl_ES@euro | greek | gv_GB | he_IL |  | he_IL.utf8 | he_IL.utf8 | hebrew | hi_IN.utf8 | hr_HR |  | hr_HR.utf8 | hr_HR.utf8 | hrvatski | hu_HU | hu_HU.utf8 |  | hungarian | hungarian | icelandic | id_ID | id_ID.utf8 |  | is_IS | is_IS | is_IS.utf8 | it_CH | it_CH.utf8 |  | it_IT | it_IT | it_IT.utf8 | it_IT@euro | italian |  | iw_IL | iw_IL | ja_JP | ja_JP.eucjp | ja_JP.sjis |  | ja_JP.ujis | ja_JP.ujis | ja_JP.utf8 | japanese | japanese.euc |  | japanese.sjis | japanese.sjis | ka_GE | kl_GL | kl_GL.utf8 |  | ko_KR | ko_KR | ko_KR.euckr | ko_KR.utf8 | korean |  | korean.euc | korean.euc | kw_GB | lithuanian | lt_LT |  | lt_LT.utf8 | lt_LT.utf8 | lv_LV | lv_LV.utf8 | mi_NZ |  | mk_MK | mk_MK | mk_MK.utf8 | mr_IN.utf8 | ms_MY |  | mt_MT | mt_MT | nb_NO | nb_NO.ISO-8859-1 | nl_BE |  | nl_BE.utf8 | nl_BE.utf8 | nl_BE@euro | nl_NL | nl_NL.utf8 |  | nl_NL@euro | nl_NL@euro | nn_NO | no_NO | no_NO.utf8 |  | norwegian | norwegian | nynorsk | oc_FR | pl_PL |  | pl_PL.utf8 | pl_PL.utf8 | polish | portuguese | pt_BR |  | pt_BR.utf8 | pt_BR.utf8 | pt_PT | pt_PT.utf8 | pt_PT@euro |  | ro_RO | ro_RO | ro_RO.utf8 | romanian | ru_RU |  | ru_RU.koi8r | ru_RU.koi8r | ru_RU.utf8 | ru_UA | russian |  | sh_YU | sh_YU | sh_YU.utf8 | sk_SK | sk_SK.utf8 |  | sl_SI | sl_SI | sl_SI.utf8 | slovak | slovene |  | slovenian | slovenian | spanish | sq_AL | sq_AL.utf8 |  | sr_YU | sr_YU | sr_YU.utf8 | sr_YU@cyrillic | sv_FI |  | sv_FI.utf8 | sv_FI.utf8 | sv_FI@euro | sv_SE | sv_SE.utf8 |  | swedish | swedish | ta_IN | te_IN | tg_TJ |  | th_TH | th_TH | th_TH.utf8 | thai | tl_PH |  | tr_TR | tr_TR | tr_TR.utf8 | turkish | uk_UA |  | uk_UA.utf8 | uk_UA.utf8 | ur_PK | uz_UZ | vi_VN |  | vi_VN.utf8 | vi_VN.utf8 | yi_US | zh_CN | zh_CN.gb18030 |  | zh_CN.gbk | zh_CN.gbk | zh_CN.utf8 | zh_HK | zh_HK.utf8 |  | zh_TW | zh_TW | zh_TW.euctw | zh_TW.utf8 |  $gDateLocale->Set('sv_SE'); // Set Swedish locale
 
   
 |