Interface ILocalizationService
Localization service interface.
public interface ILocalizationService
- Extension Methods
Remarks
When localizing resources for builder components and widgets, use IAdminBuildersLocalizationService instead.
Methods
GetString(string, string, bool)
Gets the string by the specified resource key
string GetString(string resourceKey, string culture = null, bool useDefaultCulture = true)
Parameters
resourceKeystringResource key
culturestringCulture
useDefaultCultureboolIf 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
expressionstringExpression to localize
culturestringCulture to use for localization
encodeboolIf true, translations (replacements) are HTML encoded
getStringMethodFunc<string, string, bool, string>Method to get the resource string for localization
useDefaultCultureboolIf 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
inputTextstringInput text with localizable expressions
culturestringCulture
encodeboolIf true, translations (replacements) are HTML encoded
useDefaultCultureboolIf true the default culture translation is used if translation in chosen culture doesn't exist
Returns
- string