Skip to main content
Version: 10.1

$.udb.lang.translate()

note

This article is about the lang.translate() function of the udb object.

$.udb.lang.translate()

In a string with variable elements or "markers” that need to be translated depending on the website's current language, provides the translations for these variable elements.

Returns a string.

Syntax

$.udb.lang.translate( *string-with-markers* )

Each marker is represented by the following syntax:

{{*marker*}}

You need to have supplied this translation in the language tables of USoft Definer, either as Application String or as Message. The name of the translation item must be marker.

Example

$.udb.lang.translate('<div class="box">{{Hello World}}</div>')

This example could return this string if the current language is English:

<div class="box">Hello World</div>

This example could return this string if the current language is Dutch:

<div class="box">Hallo Wereld</div>
warning

translate**()** is intended only as a dynamic extension of the standard USoft translation mechanism. Rely on that standard mechanism unless you need runtime, on-the-fly translations for custom alerts or HTML controls. Use translate() only for the latter.

See also

$.udb.lang.getTranslation()