[TYPO3] same locallang for different pi's

bernd wilke xoonsji02 at sneakemail.com
Sun Aug 31 11:11:15 CEST 2008


on Sat, 30 Aug 2008 12:57:09 +0200, Steffen Kamper wrote:

> bernd wilke schrieb:
>> now for the solution with two locallang-files:
>> http://www.pi-phi.de/t3v4/secondlocallang.html the page is in german,
>> but you need just the first box. It is a redefinition and extension of
>> pi_loadLL: first call original, then check flag for duplication
>> include. in case of no duplication include the second locallang-file.
>> in this case it is the locallang with all labels for the
>> database-tables and -fields. merge arrays with order. set inclusion
>> flag.
>> 
>> bernd
> Hi Bernd,
> 
> it would be nice if you can make a patch for it. I would use a parameter
> for it like
> function pi_loadLL($additionalLLfile = '')

hm, if you could include an additional method into class.pi_base what 
about this variant:

function pi_loadLL($additional_LL) {
  $this->pi_loadLL();
        
  if (!$this->additional_locallang_include[$additional_LL]) {
    $tempLOCAL_LANG = t3lib_div::readLLfile($additional_LL,$this->LLkey);
    //array_merge with new array first, so a value in locallang 
    //(or typoscript) can overwrite values from $additional_LL
    $this->LOCAL_LANG = array_merge_recursive($tempLOCAL_LANG
             ,is_array($this->LOCAL_LANG) ? $this->LOCAL_LANG : array()
             );
    if ($this->altLLkey) {
      $tempLOCAL_LANG = t3lib_div::readLLfile($basePath,$this->altLLkey);
      $this->LOCAL_LANG=array_merge_recursive($tempLOCAL_LANG
	     ,is_array($this->LOCAL_LANG) ? $this->LOCAL_LANG : array());
    }
    $this->additional_locallang_include[$additional_LL]=true;
  }	
}

as we (will) have php5 we should use more objektoriented mechanism.
we may redefine the method for a given first paramter.

a call without paramter will start the old version.
a call with a paramter the new one, which will call the original first. 
In this way you can have multiple languagefiles, as I changed the 
mechanism of marker to an array.

bernd
-- 
http://www.pi-phi.de/t3v4/cheatsheet.html


More information about the TYPO3-english mailing list