[英]When using IIS Express through Visual Studio 2012, resx changes are not recognized
In my html code of a C# web application I have the resx references as: 在C#Web应用程序的html代码中,我的resx引用为:
ul class="inlineList" li fmt:message key="scrollabletable.footer" / span data-bind="text: firstDisplayedRowNumber() + '-' + lastDisplayedRowNumber()" /span fmt:message key="scrollabletable.pager" / span data-bind="text: itemCount"> ul class =“ inlineList” li fmt:message key =“ scrollabletable.footer” / span data-bind =“ text:firstDisplayedRowNumber()+'-'+ lastDisplayedRowNumber()” / span fmt:message key =“ scrollabletable.pager” / span data-bind =“ text:itemCount”>
The resx code: resx代码:
<data name="scrollabletable.footer" xml:space="preserve">
<value> Showing </value>
</data>
<data name="scrollabletable.pager" xml:space="preserve">
<value> of </value>
</data>
When I view the website through ASP.NET VS Server, I can see the strings from resx displayed. 通过ASP.NET VS Server查看网站时,可以看到显示的来自resx的字符串。 But when I use IIS express, those ("Showing", "of") don't get displayed.
但是,当我使用IIS Express时,那些(“显示中”,“的”中)不会显示。
Any idea why? 知道为什么吗?
About your last comment on your post: 关于您对帖子的最新评论:
It looks like you're using a namespace fmt
on an attribute of a li
element. 似乎您在
li
元素的属性上使用名称空间fmt
。 Assuming you have the following: 假设您具有以下条件:
<!DOCTYPE html>
<html>
<head>
<!-- some stuff here -->
</head>
<body>
<!-- some stuff here -->
<ul class="inlineList">
<li fmt:message key="scrollabletable.footer" />
<span data-bind="text: firstDisplayedRowNumber() + '-' + lastDisplayedRowNumber()" />
<span fmt:message key="scrollabletable.pager" />
<span data-bind="text: itemCount">
<!-- other stuff below -->
The problem is not with your RESX. 问题不在于您的RESX。 It's with the
fmt
namespace on the message
attribute. 它与
message
属性上的fmt
名称空间一起使用。 fmt
is an unrecognized namespace in HTML since HTML has no concept of namespaces. fmt
是HTML中无法识别的名称空间,因为HTML没有名称空间的概念。 XHTML, on the otherhand, has the concept of namespaces. 另一方面,XHTML具有名称空间的概念。 When using XHTML, there's nothing stopping you from having other namespaces declared, either.
使用XHTML时,也不会阻止您声明其他名称空间。 I suggest trying the following:
我建议尝试以下方法:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fmt="urn:fmt-namespace-here" xml:lang="en">
<head>
<!-- some stuff here -->
</head>
<body>
<!-- some stuff here -->
<ul class="inlineList">
<li fmt:message key="scrollabletable.footer" />
<!-- NOTE: Instead of specifying the namespace in the html element, you could
also do the following:
<li fmt:message key="scrollabletable.footer" xmlns:fmt="urn:fmt-namespace-here" />
-->
<span data-bind="text: firstDisplayedRowNumber() + '-' + lastDisplayedRowNumber()" />
<span fmt:message key="scrollabletable.pager" />
<span data-bind="text: itemCount">
<!-- other stuff below -->
In the example above, you've declared your namespace fmt
and now the document processor will know about it and recognize it. 在上面的示例中,您已经声明了名称空间
fmt
,现在文档处理器将知道它并可以识别它。
NOTE: Since you didn't include spaces before your sample HTML in your OP, I sort of had to guess at what you wrote since all <
and >
disappeared, and possibly other content following those characters. 注意:由于您在OP中的示例HTML之前没有包含空格,因此我不得不猜测所有
<
和>
消失了之后,以及这些字符后面的其他内容之后您所写的内容。
HTH. HTH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.