Class TextApi
Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll
public class TextApi : ITextApi, IDslApi
Inheritance
Implements
Inherited Members
object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()
Extension Methods
ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<TextApi>(TextApi)
Constructors
TextApi(ITextResourceRepository)
public TextApi(ITextResourceRepository textResourceRepository)
Parameters
textResourceRepository ITextResourceRepository
Methods
CacheAndTranslate(string, string)
Cache and translate a text resource by a given key with language name (en or da)
public string CacheAndTranslate(string key, string languageName)
Parameters
key string
languageName string
Returns
The translated text corresponding to the provided key and language name.
Examples
var textApi = ctx.Use<ITextApi>();
var translatedText = textApi.CacheAndTransalte("cw_search_result_limit_exceeded", "en");
LoadTextResources(string)
Load text resources by a language name which could be en or da
var textApi = ctx.Use<ITextApi>();
var textResult = textApi.LoadTextResources("en")
public IDictionary<string, string> LoadTextResources(string languageName)
Parameters
languageName string
Returns
Translate(string, string)
Translate a text resource by a given key with language name (en or da)
var textApi = ctx.Use<ITextApi>();
var translatedText = textApi.Translate("cw_search_result_limit_exceeded", "en");
public string Translate(string key, string languageName)
Parameters
key string
The text resource key
languageName string
Language name
Returns
The translated text corresponding to the provided key and language name.