I'm in the process of writing my first module, which is also my first multi-language module. I've created the CSV files for the translation and fed them with an array of sentences I use using
in my code. Example:
"Wrong parameters were passed to this function.","Mauvais paramètres ont été passés à cette fonction."
However, trying the code in my development system using multiple URLs (and therefor languages) to access the message in different languages, I came across a strange phenomenon:
First, the text was not translated. I debugged the code and followed the
$this->__('Wrong parameters were passed to this function.')
call down to the lower levels, all the way to
on line 387. The translatable text is passed into there. Then, in line 398, the lookup key gets prefixed by the module name, to look like this:
Companyname_Modulename::Wrong parameters were passed to this function.
Naturally, this text cannot be found in the translation table loaded from the CSV file mentioned earlier. The lookup key is missing the company and module name prefix.
Why is it prefixed by the module name? How can I prevent it? I'd prefer not to prefix the texts by the module name, as the module name already is the filename of the CSV file. All tutorials I found on the web never even mentioned this. All expect the key in the translation file to be exactly the parameter to $this->('...').
Edit 1: Our translation files reside as files in our module directory and are symlinked under the names
Companyname_Modulename.csv into all applicable language directories (
The translation file configuration in our XML configuration:
<translate> <modules> <Companyname_Modulename> <files> <default>Companyname_Modulename.csv</default> </files> </Companyname_Modulename> </modules> </translate>