Navigation :
LanguageService
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 class LanguageService : ILanguageService, LanguageServiceBase
Base types
LanguageServiceBase
Implements interfaces
ILanguageService
Service to implement the retrieval of language services.
Fields
Constructors
LanguageService()
Initializes a new instance of the LanguageService class.
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 from the specified resource file with the current culture.
Parameters
Name |
Description |
languageSource |
The language source. |
resourceName |
Name of the resource. |
cultureInfo |
The culture information. |
Returns
The string ornull
if the string 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 . |
PreloadLanguageSource(ILanguageSource languageSource)
Preloads the language sources to provide optimal performance.
Parameters
Name |
Description |
languageSource |
The language source. |
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