我对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.resxOnce 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.更多推荐
发布评论