I am trying to localize stan开发者_StackOverflowdart ASP.NET login control. When I change page culture I want label 'password' to be automatically translated. I know how to work with resources in ASP.NET but I do not want to make localization myself, I am sure that microsoft has already translated all captions and error messages.
Follow this instruction :
Download and install the German language pack for .NET 2.0
In the webform's source, add
UICulture="auto"
in the<%@ Page
directive, for example:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" UICulture="auto" %>
View this page in browser, change your browser's preferred language to German, Then you should see the login control displayed in German language.
If you installed other language packs, users browsing your web site can set their preferred language and your web page will display in the language if its installed.
Hope this help you.
Source
You can try on your login control to press the tooltip and then click layout template.
Here you will get your control just like this :
<asp:Login ID="loginForm" runat="server" Height="200px" Width="442px">
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td class="style3">
<table cellpadding="0" style="height:200px;">
<tr>
<td align="center" colspan="2">
</td>
</tr>
...etc
You will find your controls as the user name label :
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" Text="<%$Resources:YourResourcefile,Key%>"></asp:Label>
and you can localize what you want.
If you can't or don't want to install the language pack, you can take control of the texts displayed by the Login
control, using the UserNameLabelText, PasswordLabelText and LoginButtonText
properties. Set them to your own resources, for example:
UserNameLabelText="<%$ Resources:resxfilename, m_lblUsername %>"
精彩评论