是否可以从代码隐藏写入本地资源文件?

发布于 2024-09-30 18:41:18 字数 514 浏览 11 评论 0原文

我在 asp.net 中创建了一个用户控件,并将其用作 Sitefinity 控件。我已启用本地化,并且有两个本地资源文件,一个默认语言和另一种语言。在 Sitefinity 中,当您将控件拖放到页面上时,您可以选择通过 Sitefinity 编辑内容和标签。我希望这些值来自本地资源文件,并且我还希望能够将这些值写入/编辑到资源文件中。

我的标签之一在后面的代码中看起来像这样(这是在 C# 中):

[Category("Username Configuration")]
public string UsernameText
{
    get
    {
        return this.GetLocalResourceObject("UsernameText");
    }
    set
    {
        ??? = value;
    }
}

因此,当您编辑控件并调出配置工具时,在“用户名配置”类别下,将有一个从本地资源检索的字符串,但我不确定如何(如果可能的话)将值写入 .resx 文件。

I've made a user control in asp.net and it's being used as a Sitefinity control. I've enabled localization and I have two local resource files, one default and another language. In Sitefinity when you drop a control onto the page you have the option of editing content and tags through Sitefinity. I want these values to come from the local resource file and I want to also be able to write/edit these values to the resource file.

One of my tags looks like this in the code behind (This is in C#):

[Category("Username Configuration")]
public string UsernameText
{
    get
    {
        return this.GetLocalResourceObject("UsernameText");
    }
    set
    {
        ??? = value;
    }
}

So when you edit the control and it brings up the config tool, under the category Username Configuration, there will be a string that was retrieved from the local resource, but I'm not sure how to (if at all possible) write a value to the .resx file.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文