according to the documentation, Language.GetByCultureCode() should return null when you pass in a culture code that is not set up for your site. Since my website is a 1:1 multi-lingual site and the language can be chosen by appending a simple query string parameter, I thought: "Hey, that's nice, I'll just pass the chosen culture code in and if it returns null, the user put in a wrong culture code so I use some other fallback language". So far for the theory...
As long as I pass in a configured culture, everything works fine. But whenever I pass in a culture code that is not configured in the backend, I get an ugly exception like this:
I saw that some other people already had problems with this and it seems that they had wrong culture codes configured in their database. Unfortunately, that's not the case for me. I have two cultures set up in my umbracoLanguage table, each one with correct values.
So what could be causing this?
Or, alternatively, is there another way to determine whether a specific culture exists?
Weird behavior of Language.GetByCultureCode()
Hi,
according to the documentation, Language.GetByCultureCode() should return null when you pass in a culture code that is not set up for your site. Since my website is a 1:1 multi-lingual site and the language can be chosen by appending a simple query string parameter, I thought: "Hey, that's nice, I'll just pass the chosen culture code in and if it returns null, the user put in a wrong culture code so I use some other fallback language". So far for the theory...
As long as I pass in a configured culture, everything works fine. But whenever I pass in a culture code that is not configured in the backend, I get an ugly exception like this:
I saw that some other people already had problems with this and it seems that they had wrong culture codes configured in their database. Unfortunately, that's not the case for me. I have two cultures set up in my umbracoLanguage table, each one with correct values.
So what could be causing this?
Or, alternatively, is there another way to determine whether a specific culture exists?
Thanks
is working on a reply...