Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 07:46 pm EST

Geeklog Forums

Language files


Anonymous

Anonymous
I'm just beginning to learn PHP. What do I have to do to use a language file in a php module. For ex: Let's take the following array in a prog. $lang_months = array('1'=>$LANG30[13], '2'=>$LANG30[14], '3'=>$LANG30[15], '4'=>$LANG30[16], '5'=>$LANG30[17], '6'=>$LANG30[18], '7'=>$LANG30[19], '8'=>$LANG30[20], '9'=>$LANG30[21], '10'=>$LANG30[21], '11'=>$LANG30[23], '12'=>$LANG30[24]); $m_num = date("n",strtotime($WorkDate)); $the_month= $lang_months[$m_num]; If I replace any value in the array I can see that it works. But using language file values doesn't. What do I have to do to make it work? Is there any include needed at the beginning of the prog.... ... I wonder if my question is understandable Thank you.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Well, of course you need to at least include the language file if you want to use its contents ... But I'd suggest you include lib-common.php instead since that will automatically pick the language file based on the settings of the current user. bye, Dirk
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Oh, I forgot: If you're doing this in a function, you also need to declare $_LANG as a global variable: global $_LANG; bye, Dirk
 Quote

Anonymous

Anonymous
That was it. global $_LANG; was missing. It now works. Thanks
 Quote

All times are EST. The time is now 07:46 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content