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?

link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

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.

link|improve this answer
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? – Adam Gerthel Jun 15 '11 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 '11 at 23:41
Thanks a lot! We got it working – Adam Gerthel Jun 16 '11 at 11:16
It is also possible to alter the implementation of a language negotiation done by another module using hook_language_negotiation_info_alter(). – kiamlaluno Jun 22 '11 at 7:19
feedback

Your Answer

 
or
required, but never shown

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