将整个页面的编码放入具有 1 个字符串的 LocalizedText.resx 全局资源文件中是错误的吗?

发布于 2024-12-27 03:32:08 字数 1255 浏览 1 评论 0 原文

我正在使用 Visual Studio 2010,并且正在按照 隐式和显式本地化的 MSDN 教程

我可以将整个 aboutus.aspx 页面代码放入LocalizedString.resx 和 LocalizedString.fr.resx 等?或者我是否必须为每个文本块创建一个新字符串?我将整个 aboutus.aspx 主要内容代码放入 .resx 文件中,页面布局工作正常。但 asp: 超链接不起作用。

我是否以错误的方式处理这个问题?我是否只需在超链接处停止字符串,然后开始一个新的字符串? .resx 页面上有 30 个字符串正常吗?

底线:

我可以将所有这些都集中在单个资源文件的字符串中吗?或者我只是将 aboutus1 放在第一个超链接之前,然后将 aboutus2 放在第一个超链接之后直到第二个超链接。编码是:

  We design, 
        engineer, and produce special machine vision error-proofing <asp:HyperLink ID="HyperLink3" runat="server" 
    NavigateUrl="~/services/" Target="_self">products and services</asp:HyperLink> 
        that create lean factories by improving the quality of manufactured 
products, and by significantly reducing manufacturing costs through advanced 
automation.

我知道我必须在替换代码的地方放入 aboutus.aspx 页面:

      <asp:Label ID="Label2" runat="server" 
    Text="<%$ Resources:LocalizedText, aboutus1 %>"></asp:Label>

但是超链接呢?我这样做的方式正确吗?我希望能够完成这些页面并结束!感谢您花时间阅读本文,如有任何建议或指导,我们将不胜感激!

I'm using Visual Studio 2010 and I'm in the process of adding 5 general languages (not dialects) to my company's website, following the MSDN tutorial on implicit and explicit localization

Can I put my entire aboutus.aspx page code into the LocalizedString.resx and LocalizedString.fr.resx and so on? Or do I have to make a new string for each block of text? I put the entire aboutus.aspx main content code into the .resx file, and the page layout worked fine. But the asp:hyperlinks didn't work.

Am I going about this the wrong way? Do I just have to STOP the string at a hyperlink, and then start a new one? Is it normal to have 30 strings on an .resx page?

The bottom line:

Can I clump this all in a string in a single resource file? Or would I just put aboutus1 until the first hyperlink, then aboutus2 after the first hyperlink until the 2nd. The coding is:

  We design, 
        engineer, and produce special machine vision error-proofing <asp:HyperLink ID="HyperLink3" runat="server" 
    NavigateUrl="~/services/" Target="_self">products and services</asp:HyperLink> 
        that create lean factories by improving the quality of manufactured 
products, and by significantly reducing manufacturing costs through advanced 
automation.

I know I'd have to put in the aboutus.aspx page wherever I replaced the code:

      <asp:Label ID="Label2" runat="server" 
    Text="<%$ Resources:LocalizedText, aboutus1 %>"></asp:Label>

But what about the hyperlinks? Am I doing this the right way? I want to be able to get these pages done and overwith! Thank you for your time in reading this, and any suggestions or guidance would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡看悲欢离合 2025-01-03 03:32:08

没有理由在您所在的位置使用 。它是一个服务器端标签,这就是为什么当您尝试从资源中输出它时它不起作用的原因。相反,您应该只使用纯 HTML 标记,如下所示:

  We design, engineer, and produce special machine vision error-proofing <a  
    href="/services/" Target="_self">products and services</a> 
        that create lean factories by improving the quality of manufactured products, and by significantly reducing manufacturing costs through advanced automation.

请注意,URL 略有不同:它开头没有 ~ ,无论如何,它仅在服务器端标记中有效。

There's no reason to use <asp:HyperLink/> where you are. It's a server-side tag, which is why it's not working when you try to have it output from the resources. Instead, you should just use a plain HTML <a> tag like so:

  We design, engineer, and produce special machine vision error-proofing <a  
    href="/services/" Target="_self">products and services</a> 
        that create lean factories by improving the quality of manufactured products, and by significantly reducing manufacturing costs through advanced automation.

Note that the URL is different, slightly: it does not have the ~ at the beginning, which is only valid in the server-side tag, anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文