Just wondering I have a function which checks the language of a page (multi-lingual site), and if not default language we need to redirect to default language for one section i.e.
if (Sitecore.Context.Language.Name != LanguageManager.DefaultLanguage.ToString())
{
Sitecore.Context.SetLanguage(LanguageManager.DefaultLanguage, true);
Response.Redirect(SourceHomeUrl(), true);
}
I am just wondering is it best to put it in pre_init i.e. do this check before anything loads and just redirect then ?
If you can do it in the pre init event, it would be better to do it there, so that you can redirect the user before any additional/unnecessary loading and processing takes place vs. doing it in page_load.
It seems reasonable but I would also look at other alternatives to handling a multilingual application like storing the language specific text in a database or resource files