Class HostLanguageResolver
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Handles mappings from host to language.
Inheritance
Inherited Members
Namespace: EPiServer.Globalization.Internal
Assembly: EPiServer.dll
Version: 10.10.4Syntax
[ServiceConfiguration(typeof(HostLanguageResolver), Lifecycle = ServiceInstanceScope.Singleton)]
public class HostLanguageResolver
Constructors
HostLanguageResolver(ISiteDefinitionRepository, IEventRegistry)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the HostLanguageResolver class.
Declaration
public HostLanguageResolver(ISiteDefinitionRepository siteDefinitionRepository, IEventRegistry eventRegistry)
Parameters
Type | Name | Description |
---|---|---|
ISiteDefinitionRepository | siteDefinitionRepository | |
IEventRegistry | eventRegistry |
Properties
HostLanguageMappings
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the host language mappings.
Declaration
public virtual StringDictionary HostLanguageMappings { get; }
Property Value
Type | Description |
---|---|
System.Collections.Specialized.StringDictionary | The host language mappings. |
Remarks
This property is used to map a host name, such as www.company.com, to a specific language.
Methods
GetDefaultHostLanguage()
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the default host language.
Declaration
public virtual string GetDefaultHostLanguage()
Returns
Type | Description |
---|---|
System.String | A string that is a culture name. If no language defined for default host (name="*"), returns null. |
Remarks
This code performs its work based on the information in the <siteHostsMappings> section in EPiServerFramework.config.
GetLanguageForHost(String, Boolean)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the language mapping defined for a host.
Declaration
public virtual string GetLanguageForHost(string hostName, bool fallback)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostName | Name of the host. |
System.Boolean | fallback | if set to |
Returns
Type | Description |
---|---|
System.String |
GetLanguageFromRequest(HttpRequestBase)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the language to use based on the host name.
Declaration
public virtual string GetLanguageFromRequest(HttpRequestBase request)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | request |
Returns
Type | Description |
---|---|
System.String | A string that is a culture name. If no match found, returns null. |
Remarks
This code performs its work based on the information in the <siteHostsMappings> section in EPiServerFramework.config.
IsHostLanguageMatch(String, String)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Determines whether the provided host is mapped to the provided language as defined either by direct hostname-to-language mapping or through wildcard language mapping.
Declaration
public virtual bool IsHostLanguageMatch(string hostName, string language)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostName | The name of the host to verify. |
System.String | language | The language to check. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
The hostname to language mapping is defined by the SiteDefinition API . The purpose of this is that the language indicator segment in the URL is not needed when you have a match between the requested language and the default language as indicated by the host name.