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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
借助 DotNetNuke,模块的本地化变得非常容易。
无论您的 .ascx(视图)文件位于何处,App_LocalResources 文件夹都应始终与其位于同一级别。该文件夹中还应该有一个相应的 .ascx.resx 文件。
一旦你的模块中有了这个结构。 DNN 将立即拾取该文件。
在 resx 中使用该资源字符串。简单地将 ResourceKey 属性附加到 ASP 控件的末尾。例如,
您的 resx 文件中应该有一个与该标签匹配的
lblExample.Text
。请注意,它会自动向其中添加.Text
。如果没有显示,则需要检查
LocalResourceFile
属性。它指向什么位置?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.
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.
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?ShowMissingKeys=true
in web.config and you'll see what resource strings you're missing.请找到本文档。我不确定它是否涵盖了您的问题以及本地化 DotNetNuke 模块与其他 Asp.Net 应用程序有何不同,但请尝试一下。
如果我可以提出一些建议,我会在将来添加更多标签(例如 C#),它将对更广泛的受众可见,这可能会带来更好的答案。
Please find this document. I am not sure if it covers your questions and how localizing DotNetNuke modules is different from other Asp.Net applications but please try it out.
If I may suggest something, I would add more tags in the future (like C# for example), it will be visible to broader audience which may result in better answers.
只需在项目中与 .ascx 视图文件同一级别创建一个名为“App_LocalResources”的文件夹即可。对于要本地化的每个文件,只需添加与视图同名的 .resx 文件(包括 .ascx 扩展名)。
Resx 名称示例:
“View.ascx.resx”
之后使用 localistion 就非常容易了。只需将要从 resx 文件中提取的控件的 Resource Key 属性设置为有意义的名称
示例:
Resx 文件:
“lblName.Text”将分配给标签的 Text 属性
如果您像上面一样使用 dnn:Labels,“lblName.Help”将分配给 DNN 工具提示属性。
如果您想开始使用 DNN 标签,只需将此标签放在页面顶部即可。
另一种方便的方法是:
它将从您的资源文件中提取,并且在处理电子邮件模板等内容时非常方便。
Simply create a folder called "App_LocalResources" on the same level as your .ascx view files in your project. For each file that you want localized, simply add a .resx file with the same name as the view (including the .ascx extension).
Resx Name Example:
"View.ascx.resx"
Using localistion is really easy after that. Simply set the Resource Key property of whichever controls you want to pull from your resx file to a meaningful name
Example:
Resx File:
"lblName.Text" will assign to the Text property of the label
"lblName.Help" will assign to the DNN Tooltip property if you are using dnn:Labels like above
If you want to start using DNN Labels simply put this tag at the top of your page.
Another handy method available is:
It will pull from your resource file and it quite handy when working with things like email templates.