Class TranslationService
- Namespace
- Dynamicweb.Content.ExternalTranslations
- Assembly
- Dynamicweb.dll
The TranslationService class providing methods for translate strings using translation providers TranslationProvider.
public class TranslationService : ICacheStorage<int, Provider>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
TranslationService
- Implements
- Inherited Members
Methods
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<int> keys)
Parameters
keys
IEnumerable<int>- Keys to reset
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(int key)
Parameters
key
int- Key to reset
Delete(int)
Dekete translation provider by id
public void Delete(int id)
Parameters
id
int
GetAll()
Get list of the available translation providers
public IEnumerable<Provider> GetAll()
Returns
GetById(int)
Get translation provider by id
public Provider GetById(int id)
Parameters
id
int
Returns
GetCache(int)
public Provider GetCache(int key)
Parameters
key
int
Returns
Save(Provider)
Save translation provider settings
public Provider Save(Provider item)
Parameters
item
Provider
Returns
Translate(CultureInfo, CultureInfo, IEnumerable<string>)
Translates list of the text strings from source language to the destination language using default translation provider
public Result<IEnumerable<string>> Translate(CultureInfo sourceLanguageInfo, CultureInfo destinationLanguageInfo, IEnumerable<string> sourceText)
Parameters
sourceLanguageInfo
CultureInfo- The source language
destinationLanguageInfo
CultureInfo- The destination language
sourceText
IEnumerable<string>- list of the source texts
Returns
Translate(int, CultureInfo, CultureInfo, IEnumerable<string>)
Translates list of the text strings from source language to the destination language using specific translation provider
public Result<IEnumerable<string>> Translate(int providerId, CultureInfo sourceLanguageInfo, CultureInfo destinationLanguageInfo, IEnumerable<string> sourceText)
Parameters
providerId
int- The translation provider id
sourceLanguageInfo
CultureInfo- The source language
destinationLanguageInfo
CultureInfo- The destination language
sourceText
IEnumerable<string>- list of the source texts
Returns
TranslateHtml(CultureInfo, CultureInfo, IEnumerable<string>)
Translates list of the html strings from source language to the destination language using default translation provider
public Result<IEnumerable<string>> TranslateHtml(CultureInfo sourceLanguageInfo, CultureInfo destinationLanguageInfo, IEnumerable<string> sourceText)
Parameters
sourceLanguageInfo
CultureInfo- The source language
destinationLanguageInfo
CultureInfo- The destination language
sourceText
IEnumerable<string>- list of the source texts
Returns
TranslateHtml(int, CultureInfo, CultureInfo, IEnumerable<string>)
Translates list of the html strings from source language to the destination language using specific translation provider
public Result<IEnumerable<string>> TranslateHtml(int providerId, CultureInfo sourceLanguageInfo, CultureInfo destinationLanguageInfo, IEnumerable<string> sourceText)
Parameters
providerId
int- The translation provider id
sourceLanguageInfo
CultureInfo- The source language
destinationLanguageInfo
CultureInfo- The destination language
sourceText
IEnumerable<string>- list of the source texts