Class ResourceStringInfoProvider
- Namespace
- CMS.Localization
- Assembly
- CMS.Globalization.dll
Provides access to resource strings stored in db.
[ProviderInterface(typeof(IResourceStringInfoProvider))]
[Obsolete("This API was not intended for public use.")]
public class ResourceStringInfoProvider : AbstractInfoProvider<ResourceStringInfo, ResourceStringInfoProvider>, IInfoProvider, ICustomizableProvider, IBulkOperationProvider, IWebFarmProvider, IInfoValidator<ResourceStringInfo>, IInfoByGuidProvider<ResourceStringInfo>, IBulkInfoProvider<ResourceStringInfo>, IResourceStringInfoProvider, IInfoProvider<ResourceStringInfo>, IInfoByIdProvider<ResourceStringInfo>, IInfoByNameProvider<ResourceStringInfo>
- Inheritance
-
objectAbstractInfoProvider<ResourceStringInfo, ResourceStringInfoProvider, ObjectQuery<ResourceStringInfo>>ResourceStringInfoProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
ResourceStringInfoProvider()
public ResourceStringInfoProvider()
Properties
DatabaseAvailable
Indicates if database is available and provider is ready to obtain translation from the database.
protected virtual bool DatabaseAvailable { get; }
Property Value
- bool
Methods
ClearHashtables(bool)
Clear hashtables.
protected override void ClearHashtables(bool logTasks)
Parameters
logTasksboolIf true, web farm tasks are logged
DeleteInfo(ResourceStringInfo)
Deletes the object to the database.
protected override void DeleteInfo(ResourceStringInfo info)
Parameters
infoResourceStringInfoObject to delete
DeleteResourceStringInfo(string, string)
Deletes resource string translation with specified StringKey and specified UI culture. If cultureCode is null, then the resource string will be deleted from all cultures, otherwise will be deleted only from specified culture.
public static void DeleteResourceStringInfo(string stringKey, string cultureCode = null)
Parameters
stringKeystringResource string key
cultureCodestringCulture code
GetCompleteKey(string, string)
Returns complete resource string key.
public static string GetCompleteKey(string stringKey, string cultureCode)
Parameters
stringKeystringResource string key
cultureCodestringCulture code
Returns
- string
GetResourceCultureCodes(string)
Gets list of culture codes for given key.
public static List<string> GetResourceCultureCodes(string key)
Parameters
keystringResource string key
Returns
- List<string>
GetResourceStringInfo(string, string)
Returns ResourceStringInfo by specified key and specified cultureCode. Always returns string object.
public static ResourceStringInfo GetResourceStringInfo(string key, string cultureCode)
Parameters
keystringResource string key
cultureCodestringCulture code
Returns
GetString(string, string)
Returns string by specified key and specified cultureCode.
public static string GetString(string key, string cultureCode)
Parameters
keystringResource string key
cultureCodestringResource string UICulture code
Returns
- string
GetString(string, string, string, bool)
Returns string by specified key and specified cultureCode.
public static string GetString(string key, string cultureCode, string defaultValue, bool useDefaultCulture = true)
Parameters
keystringResource string key
cultureCodestringResource string UICulture code
defaultValuestringDefault value in case string was not found
useDefaultCultureboolIf true the default culture translation is used if translation in chosen culture doesn't exist
Returns
- string
GetStringFromDB(string, string)
Returns string by specified key and specified cultureCode.
public static string GetStringFromDB(string key, string cultureCode)
Parameters
keystringResource string key
cultureCodestringResource string UICulture code
Returns
- string
GetStringFromDBInternal(string, string)
Returns string by specified key and specified cultureCode.
protected virtual string GetStringFromDBInternal(string key, string cultureCode)
Parameters
keystringResource string key
cultureCodestringResource string UICulture code
Returns
- string
GetStringInternal(string, string, string, bool)
Returns string by specified key and specified cultureCode.
protected virtual string GetStringInternal(string key, string cultureCode, string defaultValue, bool useDefaultCulture = true)
Parameters
keystringResource string key
cultureCodestringResource string UICulture code
defaultValuestringDefault value in case string was not found
useDefaultCultureboolIf true the default culture translation is used if translation in chosen culture doesn't exist
Returns
- string
SetInfo(ResourceStringInfo)
Inserts or Updates the object to the database.
protected override void SetInfo(ResourceStringInfo info)
Parameters
infoResourceStringInfoObject to insert / update
TranslationExists(string, string)
Returns true if translation of specified String key exist in specified Culture.
public static bool TranslationExists(string stringKey, string cultureCode)
Parameters
stringKeystringResource string key
cultureCodestringResource string Culture code
Returns
- bool