Table of Contents

Interface ITextApi

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll

Provide method for working with text resources

public interface ITextApi : IDslApi

Implements

IDslApi

Extension Methods

ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<ITextApi>(ITextApi)

Methods

CacheAndTranslate(string, string)

Cache and translate a text resource by a given key with language name (en or da)

string CacheAndTranslate(string key, string language)

Parameters

key string

language string

Returns

string

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")

IDictionary<string, string> LoadTextResources(string languageName)

Parameters

languageName string

Returns

IDictionary<string, string>

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");

string Translate(string key, string languageName)

Parameters

key string

The text resource key

languageName string

Language name

Returns

string

The translated text corresponding to the provided key and language name.