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
keysIEnumerable<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
keyint- Key to reset
Delete(int)
Dekete translation provider by id
public void Delete(int id)
Parameters
idint
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
idint
Returns
GetCache(int)
public Provider GetCache(int key)
Parameters
keyint
Returns
Save(Provider)
Save translation provider settings
public Provider Save(Provider item)
Parameters
itemProvider
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
sourceLanguageInfoCultureInfo- The source language
destinationLanguageInfoCultureInfo- The destination language
sourceTextIEnumerable<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
providerIdint- The translation provider id
sourceLanguageInfoCultureInfo- The source language
destinationLanguageInfoCultureInfo- The destination language
sourceTextIEnumerable<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
sourceLanguageInfoCultureInfo- The source language
destinationLanguageInfoCultureInfo- The destination language
sourceTextIEnumerable<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
providerIdint- The translation provider id
sourceLanguageInfoCultureInfo- The source language
destinationLanguageInfoCultureInfo- The destination language
sourceTextIEnumerable<string>- list of the source texts