[TYPO3] [SOLUTION (maybe?)] Re: sr_email_subscribe / sr_feuser_register and locallang labels
Andrew Plank
plankmeister_NO at SPAM_hotmail.com
Fri Sep 26 10:36:14 CEST 2008
Andrew Plank wrote:
> Hi,
>
> I'm trying to understand why sr_email_subscribe takes certain labels
> from the locallang file for sr_feuser_register. For example, the label
> "v_your_account_was_created".
>
> I've added this label to the locallang file for the sr_email_subscribe
> extension, but it still takes it from the locallang file for the
> sr_feuser_register extension!
>
> Is this by design? I'm using both extensions, one for users to subscribe
> to a newsletter, and the other for users to create accounts to login
> with. I want to be able to have different phrases for each extension.
>
> Am I missing something obvious?
>
> I tried adding it via TS to the _LOCAL_LANG.<lang> array, but it appears
> it's not possible to add %1, %2, %3 (etc...) variables in this manner.
>
> Any ideas?
>
> //Plankmeister
Ok... I think I have a solution to this.
In EXT:sr_feuser_register/lib/class.tx_srfeuserregister_lang.php right
near the end of the file, in the foreach loop, is the following line:
$this->pibase->LOCAL_LANG[$key] = array_merge($langArray, $locallang[$key]);
Any duplicate keys in the 2nd parameter to array_merge() will overwrite
the value for the same key in the first parameter, and the merged array
is returned. From what I can see, the parameters are being passed
incorrectly.
When I switch the two parameters around, I get perfect results.
$this->pibase->LOCAL_LANG[$key] = array_merge($locallang[$key], $langArray);
With the parameters passed in this inversed order, all the labels I
define in the sr_email_subscribe locallang file take precedence over
those defined in the sr_feuser_register locallang file.
Is there something I'm missing? I've tested both extensions with this
modification (albeit not very thoroughly) and everything seems to be ok.
Is there another reason why the paramters are passed in the "wrong"
order? If so, perhaps a patch could be released where a condition could
be tested for; one that can be set in TS to allow control over the
merging type required.
RAmen!
//Plankmeister
More information about the TYPO3-english
mailing list