I get the:

Fatal error: Call to undefined function language_negotiation_get_switch_links() in [path]\modules\translation\translation.pages.inc on line 38

error when I click the Translate tab on a blog post.

I only have English language enabled.

Comments

plach’s picture

Status: Active » Postponed (maintainer needs more info)

Would you please describe more completely the steps to reproduce this error? Also a list of the enabled modules would help.

tsvenson’s picture

Oki, will try.

The site I am building will in the future be multilingual, but start with only English. Therefore I have enabled the Content translation and Locale modules so that I can set the content to English instead of Language neutral.

I have just reproduced this on a clean Drupal 7 RC3 by doing the following:

- Install with Standard profile
- Change Basic Page CT to Multilingual with translation
- Create a new Basic Page with menu
- Click the Translate button.

Then you should get the same error as in the original post.

I then tested by adding a second language, Swedish in my case. This time I didn't get the error. Thus it only seems to appear when only one language exists.

This is not a big problem since the error doesn't cause any problems and in my case only the administrator role will see the Translate button, at least until a second language is added.

Still, Drupal should be able to catch this since this is the only way I can set the language for a node. At least as far as I know.

plach’s picture

Status: Postponed (maintainer needs more info) » Needs work
StatusFileSize
new645 bytes

Ok, reproduced. The attached patch should fix the issue.

plach’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, translation-1008628-3.patch, failed testing.

plach’s picture

Status: Needs work » Needs review

#3: translation-1008628-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, translation-1008628-3.patch, failed testing.

plach’s picture

Status: Needs work » Needs review

#3: translation-1008628-3.patch queued for re-testing.

sivaji_ganesh_jojodae’s picture

Status: Needs review » Needs work
+  include_once DRUPAL_ROOT . '/includes/language.inc';
+

Not sure whether this will really fix it but you need to use module_load_include() to add inc file.

http://api.drupal.org/api/drupal/includes--module.inc/function/module_lo...

plach’s picture

Status: Needs work » Needs review

module_load_include does not work with includes not belonging to modules

sivaji_ganesh_jojodae’s picture

Status: Needs review » Needs work

I followed the instructions in #2. It works good for me, could not reproduce any bug.

plach’s picture

@sivaji:

I was able to reproduce it: the error happens because language.inc is included only if at least two languages are enabled, hence if one access the translation page and there is only one language enabled language_negotiation_get_switch_links() won't be defined.

plach’s picture

Status: Needs work » Needs review
Issue tags: +Quick fix
StatusFileSize
new1.32 KB
new1.96 KB

Here is a simpletest that shows the issue. The test-only patch is supposed to fail to prove that the full patch correctly captures the bug. If the bot agrees this should be ready to go.

Status: Needs review » Needs work

The last submitted patch, translation-1008628-13-test.patch, failed testing.

plach’s picture

Status: Needs work » Needs review

Ok, someone please RTBC this.

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

This patch makes sense.

les lim’s picture

Status: Reviewed & tested by the community » Fixed

This appears to have been committed earlier today: http://drupal.org/cvs?commit=472224

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.