Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 29, 2011 @ 12:10
    Fuji Kusaka
    0

    Multilingual UserControl

    Hi Guys,

    Can someone point out how to make a multilingual usercontrol in umbraco? i have created a simple usercontrol but now that i need to insert it in my template i just realised its displaying the text in english only on both website.

    How to i get to translate the Submit and Error Msg in another language depending on the culture i added?

    Here is part of my control

    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="enews.ascx.vb" Inherits="umbcontactform.enews" %>
    <table border="0" align="center" cellpadding="0" cellspacing="0" class="enewsletter">
        <tr>
            <td><asp:TextBox CssClass="txtField" ID="txtemail" runat="server" Text=" " onclick="this.value=''"/> <br />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtemail" Display="Dynamic" ErrorMessage="Insert Mail First" runat="server"> </asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="Regularexpressionvalidator1" controltovalidate="txtemail" text="* Insert Invalid email" ValidationExpression="\S+@\S+\.\S{2,3}" runat="server" display="dynamic"> </asp:RegularExpressionValidator>
            </td>
        </tr>
                   <tr><td><asp:Label ID="lblmsg" runat="server"></asp:Label></td></tr>                        
        <tr>
            <td align="left">       
            <asp:LinkButton ID="lnknewsletter" OnClick="SaveNewsletter"  Text='Submit' runat="server"  CssClass="contourButton" ></asp:LinkButton></td>
        </tr>
                                           
                                          
        </table>      

     

  • Owen 123 posts 246 karma points
    Nov 29, 2011 @ 12:30
    Owen
    0

    Are you have a try with dictionary?

    I mean store the static text(such as submit) into dictionary, and set the button text depend on current language.

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 29, 2011 @ 13:53
    Fuji Kusaka
    0

    I try this but doesnt work

    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtemail" Display="Dynamic" ErrorMessage='<%= umbraco.library.GetDictionaryItem("newsletterField") %>' runat="server" />
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 29, 2011 @ 13:58
    Dirk De Grave
    1

    won't work as this is a mix up of quotes and double quote chars, but you can still set the error message using codebehind in your usercontrol

    RequireFieldValidator2.ErrorMessage = umbraco.library.GetDictionaryItem("key");

     

    Cheers,,

    /Dirk

     

  • David Verberckmoes 46 posts 77 karma points
    Nov 29, 2011 @ 13:58
    David Verberckmoes
    1

    Hi,

    set the text or errormessage property in your codebehind file to: umbraco.library.GetDictionaryItem(“mydictionaryitem”)

    Keep in mind that you need to reference umbraco.dll

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 29, 2011 @ 14:59
    Fuji Kusaka
    0

    @Dirk @David,

    Got it working......

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies