Interface ILocalizationService
Localization service interface
public interface ILocalizationService
- Extension Methods
Methods
GetString(string, string, bool)
Gets the string by the specified resource key
string GetString(string resourceKey, string culture = null, bool useDefaultCulture = true)
Parameters
resourceKey
stringResource key
culture
stringCulture
useDefaultCulture
boolIf true the default culture translation is used if translation in chosen culture doesn't exist
Returns
- string
LocalizeExpression(string, string, bool, Func<string, string, bool, string>, bool)
Localizes the given expression, handles two types of expressions:
stringkey - Simple localization
=default string|cs-cz=localized string - advanced localization
string LocalizeExpression(string expression, string culture = null, bool encode = false, Func<string, string, bool, string> getStringMethod = null, bool useDefaultCulture = true)
Parameters
expression
stringExpression to localize
culture
stringCulture to use for localization
encode
boolIf true, translations (replacements) are HTML encoded
getStringMethod
Func<string, string, bool, string>Method to get the resource string for localization
useDefaultCulture
boolIf true the default culture translation is used if translation in chosen culture doesn't exist
Returns
- string
LocalizeString(string, string, bool, bool)
Replaces "{\(stringname\)}" expressions in given text with localized strings using given culture.
string LocalizeString(string inputText, string culture = null, bool encode = false, bool useDefaultCulture = true)
Parameters
inputText
stringInput text with localizable expressions
culture
stringCulture
encode
boolIf true, translations (replacements) are HTML encoded
useDefaultCulture
boolIf true the default culture translation is used if translation in chosen culture doesn't exist
Returns
- string