Fixes routing tests and reverts to simplified routing logic based on the Language ISO code returned from the IDomain object.

This commit is contained in:
Shannon
2015-08-05 12:10:13 +02:00
parent b053638204
commit f03ee9f908
9 changed files with 67 additions and 76 deletions

View File

@@ -80,25 +80,14 @@ namespace Umbraco.Web.Models
: domainHelper.DomainForNode(int.Parse(route.Substring(0, pos)), current).UmbracoDomain;
}
if (domain == null)
if (domain == null || domain.LanguageIsoCode.IsNullOrWhiteSpace())
return GetDefaultCulture(localizationService);
//NOTE: The domain service IDomain model has changed and no longer holds a reference to IContent or ILanguage to
// improve performance, this means that we need to lookup the language below, but this was already the case previously
// in the repository and since the language lookup is cached it should be ok. If we want however we could create
// another method on the DomainService to return domains with their culture info on them
var wcDomain = DomainHelper.FindWildcardDomainInPath(domainService.GetAll(true), contentPath, domain.RootContentId);
if (wcDomain != null && wcDomain.LanguageIsoCode.IsNullOrWhiteSpace() == false)
{
return new CultureInfo(wcDomain.LanguageIsoCode);
}
if (domain.LanguageIsoCode.IsNullOrWhiteSpace() == false)
{
return new CultureInfo(domain.LanguageIsoCode);
}
return GetDefaultCulture(localizationService);
return wcDomain == null
? new CultureInfo(domain.LanguageIsoCode)
: new CultureInfo(wcDomain.LanguageIsoCode);
}
private static CultureInfo GetDefaultCulture(ILocalizationService localizationService)