Hi,

I have developed a module that create a unified header including a language switcher.
This module makes a call to language_negotiation_get_switch_links().

If only one language is defined, it makes a Call to undefined function language_negotiation_get_switch_links() error.

I improved my module by testing the number of languages but this bug blocks site developers to prepare functionnality before configuring the languages.

Comments

penyaskito’s picture

IMHO this is a bug on your code.
Makes sense to get language switch links if you have no urls to switch to?

I would wrap your call to language_negotiation_get_switch_links() like:

if (drupal_multilingual()) {
  // Do whatever you plan with language_negotiation_get_switch_links().
} 
penyaskito’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Or maybe you need to add

  include_once DRUPAL_ROOT . '/includes/language.inc';

Please reopen if this does not fix your issue.