Class LocalizationService
- Namespace
- CMS.Localization
- Assembly
- CMS.Globalization.dll
Localization service including the database operations.
public class LocalizationService : ILocalizationService
- Inheritance
-
objectLocalizationService
- Implements
- Extension Methods
Methods
GetString(string, string, bool)
Returns specified string.
public 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
public 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.
public 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