AJAX:CalendarExtender 未本地化今天

发布于 2024-12-06 01:48:44 字数 162 浏览 1 评论 0原文

我正在使用 AJAX 库中的 CalendarExtender,并且可以进行本地化。目前一切工作正常,除了当我尝试将其本地化为 Danich (da-DK) 语言时。日历看起来是本地化的,除了“今天”的部分仍然是英文。您如何本地化该部分?

附言。如果无法本地化,我可以隐藏日历的“今天”部分吗?

I'm using the CalendarExtender from the AJAX library with the possibility of localization. Currently everything works fine except when I try to localize it for the Danich (da-DK) language. The calendar looks localized, except the part that says "Today" that remains in English. How do you localize that part too?

PS. And if localization is not possible, can I hide "Today" part of the calendar?

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

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

发布评论

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

评论(3

忘你却要生生世世 2024-12-13 01:48:44

关于:

PS。如果无法本地化,我可以隐藏日历的“今天”部分吗?

由于我们认为添加我们自己的资源更值得,所以我们决定隐藏“今天”位。不过,通过将以下内容添加到我们的 css 文件中,可以轻松完成此操作:

.ajax__calendar_footer {
    display: none;
}

Re:

PS. And if localization is not possible, can I hide "Today" part of the calendar?

As we deemed it more work that it was worth to add our own resources, we decided to hide the "Today" bit. This was however easily done by adding the following to our css file:

.ajax__calendar_footer {
    display: none;
}
哥,最终变帅啦 2024-12-13 01:48:44

默认情况下,Ajax Control Toolkit 未针对丹麦语进行本地化。您需要稍微定制一下工具包解决方案。下载工具包源并将丹麦语资源文件添加到 MicrosoftAjax.Extended 项目(ExtenderBase 文件夹)中。您只需创建 BaseScriptsResources.resx 文件的副本并将副本文件名更改为“BaseScriptsResources.ds.resx”。我相信您可以轻松找到该文件中必须为您的语言更改的资源值。
之后,将该文件作为链接添加到 AjaxControlToolkit 项目的 ScriptResources 文件夹中。当您构建解决方案时,您将在项目的 bin 文件夹 (da/AjaxControlToolkit.resources.dll) 中找到一个包含丹麦资源程序集的新文件夹。只需将该文件夹与 dll 复制到项目的 bin 文件夹中即可。

By default Ajax Control Toolkit doesn't localized for the Danish. You need to customize toolkit soulution a bit. Download toolkit sources and add Danish resource file into MicrosoftAjax.Extended project (ExtenderBase folder). You may just create a copy of BaseScriptsResources.resx file and change copy file name to "BaseScriptsResources.ds.resx". I believe you easy find which resource value in that file you must change for your language.
After that add that file as a link into ScriptResources folder of the AjaxControlToolkit's project. When you build up solution you will find a new folder with a Danish resource assembly in project's bin folder (da/AjaxControlToolkit.resources.dll). Just copy that folder with a dll to your project's bin folder.

调妓 2024-12-13 01:48:44

在添加了特定语言的本地化后,我们在使用旧版本 AjaxControlToolkit (4.1) 的遗留项目中遇到了同样的问题。我绝对不想编译我自己的 AjaxControlToolkit 版本。

因此,在深入研究 CalendarExtender 的 JavaScript 源代码后,我注意到文本是从资源加载的,并且可以修改该资源。长话短说,如果您

  • 在工具包的脚本完成后 在 JavaScript 中更新 Sys.Extended.UI.Resources.Calendar_Today(默认值:Today:{0})加载但
  • 在用户第一次打开日历之前,

则资源值将替换为您的值:

<!-- Add this to the bottom of your page -->
<script type="text/javascript">
    Sys.Extended.UI.Resources.Calendar_Today = "Σήμερα: {0}";
</script>

显然,如果您的应用程序是多语言的,您将拥有自己的翻译资源文件:

<script type="text/javascript">
    Sys.Extended.UI.Resources.Calendar_Today =
        '<%= HttpUtility.JavaScriptStringEncode(Resources.MyTexts.Today) %>';
</script>

We just had the same problem in a legacy project using an old version of AjaxControlToolkit (4.1), after localization to a specific language has been added. And I definitely did not want to compile my own version of AjaxControlToolkit.

Thus, after digging through CalendarExtender's JavaScript source, I noticed that the text is loaded from a resource, and that this resource can be modified. To make a long story short, if you update Sys.Extended.UI.Resources.Calendar_Today (default: Today: {0}) in JavaScript

  • after the Toolkit's scripts have been loaded but
  • before the user opens the Calendar for the first time,

then the resource value is replaced by your value:

<!-- Add this to the bottom of your page -->
<script type="text/javascript">
    Sys.Extended.UI.Resources.Calendar_Today = "Σήμερα: {0}";
</script>

Obviously, if your application is multi-lingual, you will have your own translation resource files:

<script type="text/javascript">
    Sys.Extended.UI.Resources.Calendar_Today =
        '<%= HttpUtility.JavaScriptStringEncode(Resources.MyTexts.Today) %>';
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文