DNN中的模块本地化(Module Localization in DNN)

系统教程 行业动态 更新时间:2024-06-14 16:59:46
DNN中的模块本地化(Module Localization in DNN)

我对DNN中的本地化过程了解不多。 问题是,你如何本地化一个新的模块?

是否可以将本地化文件分别包含在每个模块中? 你可以想出什么解决方案?

I don't know much about the localization process in DNN. The question is that how can you localize a new module?

Is it possible to include localization files with every module separately? What solutions can you come up with?

最满意答案

感谢DotNetNuke,模块的本地化非常简单。

无论您的.ascx(View)文件在哪里,App_LocalResources文件夹都应该始终伴随在同一级别上。 该文件夹中还应该有一个对应的.ascx.resx文件。

view.ascx App_LocalResources - view.ascx.resx

一旦你在你的模块中有这样的结构。 DNN会立即选取文件。

在resx中使用该资源字符串。 将ResourceKey属性简单粘贴到您的asp控件的末尾。 例如

<asp:Label ID="lblExample" runat="server" ResourceKey="lblExample" />

你应该在你的resx文件中有一个lblExample.Text ,它与该标签相匹配。 请注意,它会自动添加.Text 。

如果没有显示出来,有几件事要检查

代码中的LocalResourceFile属性。 它指向哪个位置? 在web.config中设置ShowMissingKeys=true ,你会看到你缺少的资源字符串。

Localization of a module is pretty easy thanks to DotNetNuke.

Wherever your .ascx (View) file is, the App_LocalResources folder should always accompany it, on the same level. There should also be a corresponding .ascx.resx file in that folder.

view.ascx App_LocalResources - view.ascx.resx

Once you have that structure in your module. DNN will pick the file up immediately.

To use that resource strings in the resx. Simple tack on the ResourceKey property to the end of your asp controls. e.g.

<asp:Label ID="lblExample" runat="server" ResourceKey="lblExample" />

You should have a lblExample.Text in your resx file which matches up with that label. Note that it adds .Text to it automatically.

If it's not showing up, there are a few things to check

LocalResourceFile property in code. What location is it pointing to? set ShowMissingKeys=true in web.config and you'll see what resource strings you're missing.

更多推荐

本文发布于:2023-04-17 08:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/1ba59f576ce1c3e85f8e483b71c3e243.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   DNN   Localization   Module

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!