WebControl for language specific strings.

Namespace:  EPiServer.Web.WebControls
Assembly:  EPiServer.Web.WebControls (in EPiServer.Web.WebControls.dll) Version: 6.0.530.0

Syntax

C#
[DefaultPropertyAttribute("Text")]
public class Translate : WebControl

Remarks

Use the Translate control to translate your own strings or one of the built in strings in the /lang directory of you site. The test shown will vary by the current users chosen language (if chosen) or the system default.

The control uses the LanguageManager to translate the text. You can access the LanguageManager through code using the LanguageManager.Instance static property.

Examples

Using the Translate Control

This will show the translated value for the /button/search language resource.

CopyC#
<episerver:translate text="/button/search" runat="server"/>

Translating ASP Intrinsic controls

EPiServer can also translate ASP Controls like the Label web control. In the PreRender event EPiServer will search all known controls in the control hierarchy with an attribute called translate (case insensitive) and translate the textual value of the control.

CopyC#
<asp:button id="QuicksearchButton" runat="server" translate="/button/search" />
Note: Note: If you do not want automatic translation you can turn it off by setting the AutomaticTranslation property in your template to false.

Inheritance Hierarchy

System..::.Object
  System.Web.UI..::.Control
    System.Web.UI.WebControls..::.WebControl
      EPiServer.Web.WebControls..::.Translate

See Also