My first attempt at posting anything in drupal so be gentle... Searched forums for similar issues. Checked bug list, read readme's have not seen this issue mentioned.
My testsite is fully set-up with i18n module - seems to work OK, however when I try to add the Organic Groups module my Site refuses to load and the following error is logged to my apache logs:
[Wed May 03 09:49:15 2006] [error] [client 127.0.0.1] PHP Fatal error: Cannot redeclare i18n_get_lang() (previously declared in J:\\testsite\\var\\www\\drupal\\modules\\og\\og.module:107) in J:\\testsite\\var\\www\\drupal\\modules\\i18n\\i18n.inc on line 284
I can eliminate the problem by renaming the og.module i18n function, however, I notice that the content in the 2 modules is different. So far I can't see that renaming the module actually breaks anything but I am still trying to get my head around organic groups. I realize that both these modules are still in progress, so this might already be under consideration (or I've made a mistake) but I hope these 2 modules can co-exist.
Setup:
Drupal 4.7 RC3
i18n CVS: i18n.inc,v 1.16 2006/04/27 14:59:19 jareyero
og CVS: og.module,v 1.110.2.68 2006/05/02 14:55:26 weitzman
Note that I am tagging against Organic groups as i18n_get_lang probably is more core to the i18n module than Organic groups.
Comments
Comment #1
pancapangrawit commentedHi,
I have the same problem (Drupal 4.7 og&i18n as of 15.5.06) - is there a provisorical way to get those two work alongside? For the time being I could do without the language-choice-function in og.
Best
.r.
Comment #2
moshe weitzman commentedsomeone needs to writeup the desired behavior when both these modules are enabled.
Comment #3
adixon commentedthe short answer for most folks with this question is : rename the og version of this function to something unused (i renamed it to og_i18n_get_lang).
i think the longer answer is for i18n to provide a hook for other modules to modify it's way of choosing its language.
currently, the i18n_get_lang logic looks like this:
In other words, the language is decided, in priority order, from:
with a fall back to drupal's default language.
A general way to interact with this would be for i18n to instead convert the above logic into an associative array '$get_languages' with keys:
path =>
user =>
browser =>
default =>
and then pass it to the module hooks which could interject or reorder it,
and then i18n would just use reset($get_languages) to shift the first value off the top.
In this model, organic groups would just interject the current group's default language after the user value.
If this seems sensible, i can write up some code.
Comment #4
jose reyero commentedWell, that may work but the thing is that if you are not using og + i18n, that hook will never be called.
So I think we need something like a conditional definition + specific function call
What I'm trying to understand is why og module needs to set the language that early in the page generation and cannot just overwrite the 'locale' global variable.
Anyway, I've recently started to use og -I really like it :-) and would like both modules besides being 'compatibles' to play together. I mean we could add an og function call in i18n, in the i18n_get_lang logic or maybe expose globally i18n's language so og can also override it.
So I agree with Moshe about writing up the desired behaviour before anything else. If someone's in a hurry to get it working, you can add in og module -which because of the module naming is most likely to load later I think-, a conditional definition -which btw is exactly what I've done so far...
Comment #5
moshe weitzman commentedi didn't know about the global $locale variable. that looks good. but if i move this to hook_menu(!$may_cache), then all the static menu items will be in the default language and the rest of the page in the group language. and if i read the code right, andy subsequent uses of phrases that were first shown in the default language will remain in the default language.
So it seems that og does't need to use the i18n function name so thats how we avoid the error for now. any comments?
Comment #6
moshe weitzman commentedabout to commit a fix. requires the very latest core HEAD or core DRUPAL-4-7 ... the above error goes away because of no longer uses this special function.
Comment #7
moshe weitzman commentedComment #8
pancapangrawit commentedCooool! Thank you so much. Ich will test this weekend.
.r.
Comment #9
(not verified) commentedComment #10
isma44 commentedI solved this problem by Jose's hint. Thanks!
Change as follwing the module source at modules/localizer/localizer.module about 1278~1280 lines
Previous:
if (module_exists('localizer')) {
Fixed:
if( module_exists('localizer') && !function_exists('i18n_get_lang') ) {
Be careful at "{" and "if ( ... )".
Comment #11
isma44 commentedOops... I thinked shortly.
The duplicated function has very different routine which is located in i18n.module 28line.
Will "Localizer" module occurr some errors when is running with "i18n" module simultaneously?