ILanguageService

Name Value
Assembly Catel.Core
Namespace Catel.Services
Available on .NET Framework 4.5, .NET Framework 4.6, Portable Class Libraries, Xamarin - Android, Xamarin - iOS
public interface ILanguageService

Service to implement the retrieval of language services.

Properties

CacheResults

Gets or sets a value indicating whether the results should be cached. The default value istrue.

FallbackCulture

Gets or sets the fallback culture.

PreferredCulture

Gets or sets the preferred culture.

Events

LanguageUpdated

Occurs when the FallbackCulture or PreferredCulture are updated.

Methods

ClearLanguageResources()

Clears the language resources.

GetString(ILanguageSource languageSource, string resourceName, CultureInfo cultureInfo)

Gets the string with the specified language source and culture.

Parameters

Name Description
languageSource The language source.
resourceName Name of the resource.
cultureInfo The culture information.

Returns

The string ornull if the resource cannot be found.

Exceptions

Name Description
ArgumentNullException The languageSource isnull.
ArgumentException The resourceName isnull.

GetString(string resourceName)

Gets the string with the PreferredCulture. If the preferred language cannot be found, this method will use the FallbackCulture to retrieve the string.

Parameters

Name Description
resourceName Name of the resource.

Returns

The string ornull if the resource cannot be found.

Exceptions

Name Description
ArgumentException The resourceName isnull.

GetString(string resourceName, CultureInfo cultureInfo)

Gets the string with the specified culture.

Parameters

Name Description
resourceName Name of the resource.
cultureInfo The culture information.

Returns

The string ornull if the resource cannot be found.

Exceptions

Name Description
ArgumentException The resourceName isnull.
ArgumentNullException The cultureInfo isnull.

PreloadLanguageSources()

Preloads the language sources to provide optimal performance.

RegisterLanguageSource(ILanguageSource languageSource)

Registers the language source.

Parameters

Name Description
languageSource The language source.

Exceptions

Name Description
ArgumentNullException The languageSource isnull or whitespace.

Have a question about Catel? Use StackOverflow with the Catel tag!


Discussion