We're currently building a rather large website that will be release in swedish initially, but other languages later on. For this reason we've built everything in english and then translated everything to swedish. For the release, only swedish should be accessible. This is where the problem begins.

-We don't want / can't use language URL prefixes for different reasons (PURL clashes, uglyness, won't need once the site is available in more than one language)

-We can't use Swedish as default language because that will break all of the translations (string translations will then consider swedish as the original language). Since everything from fields, labels, content types, help text etc. are in english originally this is not an option.

-We can use browser detection, but that isn't really fool-proof and doesn't cover all cases. A lot of users in sweden use english as browser language.

-We could use IP location, as an addition to the above, but it's not fool proof either.

What we would really need is to use Swedish as the default language but somehow use english as the language of origin. Is this possible somehow?

  • Have you find any better solution (a module maybe?) than implementing hook_language_negotiation_info()?
    – Isaac
    Dec 18, 2013 at 20:28

3 Answers 3


Drupal 7?

The language negotiation is extendable, you just need to implement hook_language_negotiation_info(). In there, you can do whatever you want, like always default to swedish for now. It also looks like you can limit to what languages you can switch to, I am not sure how that exactly works, though.

Not sure what to do once you add more languages, but you could for example call other negotiation callbacks in yours and fallback to swedish if it not one of the languages you want displayed.

  • Hmm.. ok so you're saying we can use english as default language (by default I mean setting it as "default" in admin/config/regional/language/overview) and still force all visitors to the swedish version, even though we can't rely on either of the standard "detection and selection" methods? Jun 15, 2011 at 21:40
  • You can create your own "detection and selection" methods with the hook linked above, in which you can return whatever language you want as default. I haven't done that myself, but it should work.
    – Berdir
    Jun 15, 2011 at 23:41
  • It is also possible to alter the implementation of a language negotiation done by another module using hook_language_negotiation_info_alter().
    – apaderno
    Jun 22, 2011 at 7:19

This question is old, but I think that this answer could be still useful to someone. A module with this functionality now esists, you can find it here: https://drupal.org/project/fallback_language_negotation

I'm a developer, but I don't know enough Drupal to write modules and implement hooks. I badly needed this functionality, but I couldn't do it by myself.

That module it's also very simple, so it's good for beginners to understand how to write modules.


Maybe you are missing some information (might not matter now, 3 years hence), but to me it seems straightforward: use URL detection, and configure the detector to use domains, then set your site' domain for Swedish, and a prefix for English. That way, it will always default to Swedish because it matches your domain, and never to English, because it doesn't care about prefixes (you are, however forced to enter either prefix or domain in the language config).

An alternative might be to alter the URL language negotiator in core, this can be done via hook_language_negotiation_info_alter(). There seems to be very little documentation on this, but I've used it with success to implement some similar logic in a custom module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.