Forums | Mahara Community
Support
/
Cannot redeclare plural_en_utf8
02 July 2012, 7:22
Hi
I installed the lastest version of mahara (1.5.1.) - fresh, do avoid updating problems, being discussed in this forum ;-)
But now I faced an error when logging out or when clicking at contact, etc.:
Fatal error: Cannot redeclare plural_en_utf8() (previously declared in /home/.sites/383/site150/web/eportfolio/lang/en.utf8/langconfig.php:57) in /home/.sites/383/site150/web/eportfolio/lang/en.utf8/langconfig.php on line 59
Although I tried to install German language and set this as default, the error maintained.
Does anyone can support me to solve this?
Thanks in advance and kind regards!
Conrad
02 July 2012, 14:14
As the error says there are two functions declared, both with the same name. If you look carefully to the error message it becomes obvious that the error message says:
There are two functions named plural_en_utf8(). One is on line 57 and the other is on line 59 - both in the /home/.sites/383/site150/web/eportfolio/lang/en.utf8/langconfig.php file
That is odd. There should be only one plural_en_utf8() function. Try to look inside that file and if there are indeed two function with the same name (and they are the same) try to delete one.
HTH,
Gregor
03 July 2012, 5:25
Hello Gregor,
thanks for your reply and helb.
I tried as you adviced, but did not succeed.
Here is the code of the original langconfig.php:
_______
...
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['parentlanguage'] = '';
$string['strftimedate'] = '%%e %%B %%Y';
$string['strftimedateshort'] = '%%d %%B';
$string['strftimedatetime'] = '%%d %%B %%Y, %%l:%%M %%p';
$string['strftimedatetimeshort'] = '%%Y/%%m/%%d %%H:%%M';
$string['strftimedaydate'] = '%%A, %%d %%B %%Y';
$string['strftimedaydatetime'] = '%%A, %%d %%B %%Y, %%l:%%M %%p';
$string['strftimedayshort'] = '%%A, %%d %%B';
$string['strftimedaytime'] = '%%a, %%k:%%M';
$string['strftimemonthyear'] = '%%B %%Y';
$string['strftimerecent'] = '%%d %%b, %%k:%%M';
$string['strftimerecentyear'] = '%%d %%b %%Y, %%k:%%M';
$string['strftimerecentfull'] = '%%a, %%d %%b %%Y, %%l:%%M %%p';
$string['strftimetime'] = '%%l:%%M %%p';
$string['strfdaymonthyearshort'] = '%%d/%%m/%%Y';
$string['strfdateofbirth'] = '%%Y/%%m/%%d';
$string['strftimew3cdatetime'] = '%%Y-%%m-%%dT%%H:%%M:%%S%%z';
$string['strftimew3cdate'] = '%%Y-%%m-%%d';
$string['thislanguage'] = 'English';
$string['locales'] = 'en_US.utf8,en_GB.utf8,en,english-us,english-uk,english';
// Rule to choose from the language's plural forms.
// See the gettext manual, http://www.gnu.org/s/hello/manual/gettext/Plural-forms.html
// For language packs converted from PO format, the following strings and function will be
// automatically generated from the expression in the PO file's "Plural-Forms:" header.
$string['pluralrule'] = 'n != 1';
$string['pluralfunction'] = //'plural_en_utf8';
function plural_en_utf8($n) {
return (int) $n != 1;
}
______
Could not believe that tha php file in the original package has a bug :-(
What else could cause this?
Today the login failed. I got the error massage as described. So I can't even get in mahara ;-(
Tanks
Conrad
03 July 2012, 8:35
Conrad,
Do you have another copy of the English language pack in the langpacks directory in your data directory?
Thanks,
Melissa.
03 July 2012, 9:52
Hi Melissa,
there is only one English Language Pack (en.utf8)
I installed the 1.5.1. Pack as instructed and without any customizations. The installation itself was successful.
Kollation: utf8_general_ci
MySQL /InnoDB: 5.1.52
PHP Version: 5.3.8
Thanks and Regards
Conrad
03 July 2012, 11:04
$string['pluralfunction'] = //'plural_en_utf8';
Try to uncomment the upper line (two red slash characters). I don't have that commented in my 1.5.1 Mahara English langpack.
Other than that, I have no idea...
HTH,
Gregor
03 July 2012, 11:24
Hello Gregor,
thank you for your help. Although commenting out "plural_en_utf8';" did not fix the problem your mention, that those code lines have not been in your package, showed me how to try to fix it.
I deleted
$string['pluralrule'] = 'n != 1';
$string['pluralfunction'] = ;//'plural_en_utf8';
function plural_en_utf8($n) {
return (int) $n != 1;
}
(accordingly in the German langpack).
Now the problem is fixed. (I hope that this fix does not cause problems elsewhere ;-)
Thanks to Gregor and Melissa for supporting me!
Kind Regards
Conrad
04 July 2012, 3:11
As Melissa pointed in email, this is similar to https://bugs.launchpad.net/mahara-adminlang/+bug/1012580
In translation GUI the problem appeared on the attempt to include langconfig.php more than once (Translation GUI tries to load the same language file for editing, thus the error appear, as the function has been declared already when language was loaded for Mahara itself).
Conrad, do you have more than one language in your Mahara? I guess the problem might be related that in some different language, the translator has not renamed plural_en_utf8() according to the language, so you indeed have this function declared twice. Try searching for plural_en_utf8() through your code and see if it appears more than once. If this will not help, try searching for 'langconfig.php' in the code and see if it is included more than once also (especially if you have local modifications).
05 July 2012, 9:30
Hi Ruslan,
thanks for your advice. I understand the errorcause and also what lies behind it. But I am not so common with mahara to find that second declaration of Plural forms if not in languageconfig.php. And there seems to be the correct code
$string['pluralrule'] = 'n != 1';
$string['pluralfunction'] = 'plural_en_utf8';
function plural_en_utf8($n) {
return (int) $n != 1;
}
May be the bug - as far as I remember - happened after I had installed German language pack. But in this language Pack the plural function is translated correct: "plural_de_utf8".
I tried to comment out those lines containing "plural_en_utf8()" in the english languageconfig.php. But then the error only changed from "plural_en_utf8()" to "plural_de_utf8" in the languageconfig.php of "/de.utf8/".
I used the install-pack for mahara 1.5.1. downloaded from mahara.org and I did not apply any modificatins or customizations - with the exeption of installing the German Langage Pack, also taken from mahara.org for 1.5
So the only way for me to get mahara go is to comment out all those lines within german and englisch langconfigs who declare plural forms. But as mentioned I don't know what this my cause on another function within mahara.
Thanks and Kind Regards
Conrad
11 October 2013, 22:40
I was having a similar problem and fixed it temporaraly the same way commenting the plural function, but this meant that whereever there was a list which said how many entries in a journal or members in a gorup etc it didn't work.
I finally manage to track down a fix that works and keeps the finstion working
in lib/mahara.php
on line 783 is should be
include ($langfile);
Change this to
incluce_once($langfile);
This stops it trying to reload the file and redeclare the function
Hope that helps anyone else
- «Previous page
- 1
- 2
- »Next page