New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Localization

Choose Language:



RadCaptcha provides a mechanism for quick and easy localization, based on the native ASP.NET localization.

The ErrorMessage, the Label telling the user to enter the code and the button labels are obtained from the resource files located in the App_LocalReources directory. Thus, the language of the Captcha is automatically switched to the culture and UI culture of the Web page

Each of the localization strings can also be modified at runtime by using the respective properties of the RadCaptcha control: ErrorMessage, CaptchaTextBoxLabel, CaptchaAudioLinkButtonText, and CaptchaLinkButtonText. This saves the need to create a new localization file to change a single string.

The example uses the approach described in this Microsoft help article to programmatically change the culture and UI culture of an ASP.NET Web page.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • Styles.css
<%@ Page Language="vb" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.Web.Examples.Captcha.Localization.DefaultVB"Culture="auto" UICulture="auto"  %>

<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecorationZoneID="zoneToDecorate" DecoratedControls="All" />
    <div id="localization" class="demo-container no-bg">
        <div class="divContainer" id="zoneToDecorate">
            <div class="divLanguage">
                <asp:Label ID="lblChooseLanguage" runat="server" Text="Choose Language:" ForeColor="White"
                    Style="line-height: 25px;" meta:resourcekey="Label1Resource1"></asp:Label><br />
                <asp:ListBox ID="chooseLanguage" runat="server" AutoPostBack="true" Width="100px">
                    <asp:ListItem Text="English" Value="en-US" Selected="True"></asp:ListItem>
                    <asp:ListItem Text="Francais" Value="fr-FR"></asp:ListItem>
                    <asp:ListItem Text="Deutsch" Value="de-DE"></asp:ListItem>
                </asp:ListBox>
                <input type="hidden" name="cultureListBox" value="<%= chooseLanguage.UniqueID %>" />
            </div>
            <telerik:RadCaptcha ID="RadCaptcha1" runat="server" EnableRefreshImage="true" Display="None"
                Width="400px" ErrorMessage="Page not valid!" CaptchaTextBoxLabelCssClass="rcLabelClass"
                CaptchaTextBoxCssClass="rcTextBoxClass" CaptchaLinkButtonText="" meta:resourcekey="RadCaptcha1Resource1">
                <CaptchaImage EnableCaptchaAudio="true" UseAudioFiles="true" TextChars="Numbers"
                    TextColor="#cadada" BackgroundColor="#3f4f4f"></CaptchaImage>
            </telerik:RadCaptcha>
            <div class="divButton">
                <asp:Label ID="lblErrorMessage" runat="server" ForeColor="White"></asp:Label>
                <br />
                <br />
                <asp:Button ID="Button1" runat="server" Text="Submit Page" Width="200px" OnClick="Button1_Click"
                    meta:resourcekey="Button1Resource1"></asp:Button>
            </div>
        </div>
    </div>
    
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance