开发者

C# Localization - unexpected behaviour

开发者 https://www.devze.com 2022-12-30 20:15 出处:网络
I have the following line of code: <%= Html.Label((string) GetLocalResourceObject(\"Label_Email\")) %>

I have the following line of code:

<%= Html.Label((string) GetLocalResourceObject("Label_Email")) %>

This generates a label within an HTML page.

In the local resource file I have the following entry:

Name: Label_Email Value:Email

For some very strange reason when I load the page in the browser, it generates an HTML label with a value of "Email Address" instead of "Email". This is a seri开发者_JAVA技巧ous problem for me because I need to localize the application and not have english word "address".

When I replace Value in the local resouce file with "Email " (notice extra space), everything works fine, but this is a hack and I need to understand why my application is behaving this way.

Thank you


First check if your Label is really read from this resource. to check it, change the Value (to Your name or etc).

Then get sure which the label exactly shows the value. if it doesn't display your value at all then your implemenation is wrong. but it shows the changes value. it should be works fine.

If it doesn't work try this

<asp:label id="Label_Email" runat="server" meta:resourcekey="Label_Email" />

and note that in your resource file youhave to insert

Label_Email.Text = "something"

not

Label_Email = "wrong"

0

精彩评论

暂无评论...
验证码 换一张
取 消