是否可以创建多语言帮助 (.chm) 文件?

发布于 2024-12-01 19:51:05 字数 52 浏览 2 评论 0 原文

我需要为我的 WPF 应用程序创建多语言帮助 (.chm) 文件。请建议创建它的最佳方法。

I need to create multilingual help (.chm) file for my WPF application. Please suggest best way to create it.

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

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

发布评论

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

评论(2

痕至 2024-12-08 19:51:05

如果可能的话,我会尽力避免这种情况。 CHM 是一种专有格式,尽管它已被逆向工程,但我认为您将从真正可移植的解决方案(如磁盘 HTML)中获得更多好处。

当我们仍然使用 CHM 文件时,我们发现没有简单的方法将多语言功能嵌入到单个文件中,我们必须在独立的 CHM 文件中提供翻译,从而导致图表等内容的大量重复,图片等等(这是很多年前的事了,所以如果您真的想使用 CHM,您应该检查自那时以来情况是否有所改善)。

容我们说,对 Unicode 的支持不够充分,并且存在许多安全问题,导致许多客户不允许使用 CHM 文件 - 说真的,谁头脑正常会允许帮助系统运行任意代码?

有了磁盘上的 HTML,不仅这种重复消失了(因为每种语言版本都包含通用图像),我们还获得了更好的 Unicode 支持,并且能够拥有默认首页(英文),并链接到其他语言的替代首页。语言环境。

由于它是一个开放标准,因此我们在可移植性方面获得了巨大的提升。这意味着我们几乎可以在任何平台上的任何浏览器中运行它。


而且,最重要的是,微软似乎不再支持它。来自维基百科 CHM 文章

2002 年,Microsoft 宣布了与 .CHM 格式相关的安全风险以及安全公告和补丁。此后他们宣布不再进一步开发 .CHM 格式。

I'd try to steer clear of that if possible. CHM is a proprietary format and, although it has been reverse engineered, I think you'll get far more benefit from doing a truly portable solution like on-disk HTML.

Back when we still used CHM files, we found no easy way to embed multi-language capability into a single file and we had to provide translations in independent CHM files, leading to massive duplication of things like charts, pictures and so forth (this was many years ago so you should check if the situation has improved since then, if you really want to use CHM).

The support for Unicode was, shall we say, less than adequate, and there were numerous security problems which caused many customers to disallow use of CHM files - seriously, who in their right mind allows arbitrary code to be run by a help system?

With on-disk HTML, not only did this duplication disappear (since each language version included common images), we also got much better Unicode support and the ability to have a default front page (in English) with links to alternative front pages for other locales.

And we gained a big boost in portability since it's an open standard. That means we could pretty much run it in any browser on any platform.


And, on top of that, it appears Microsoft don't support it any more. From the Wikipedia CHM article:

In 2002, Microsoft announced security risks associated with the .CHM format, as well as security bulletins and patches. They have since announced their intentions not to develop the .CHM format further.

2024-12-08 19:51:05

正如之前答案中的评论所述,CHM 格式既是 Microsoft 的一种非常古老的格式,也是专有的。将 HTML 文件与您的应用程序一起分发将实现与单个 CHM 文件相同的功能。担心用户将看到的用户界面的语言并不是问题;如果用户正在阅读意大利语帮助,他或她很可能会使用 (1) 意大利语本地化版本的 Windows 和 (2) 意大利语本地化 Web 浏览器。

话虽如此,由于 CHM 是一种格式,并且现在似乎部分不受支持,因此您可以基于反向工程 CHM 文件遵循的规范。此外,由于 CHM 只是一种包含 HTML 文件的二进制文件格式,因此使用 UTF-8 对 HTML 文件进行编码将能够以您想要的任何语言获取帮助文档本身。

没有 Microsoft 支持的 CHM .NET API,因此您必须使用 Streams / BinaryWriter 自己输出二进制文件。

As the comments in the previous answer state, the CHM format is both a very old format by Microsoft, as well as being proprietary. Distributing HTML files with your application will accomplish the same functionality as a single CHM file. Worrying about the language of the user interface the user will see is more of a non-issue; chances are if the user is reading Italian help, he or she will be using a (1) Italian-localized version of Windows and (2) an Italian-language localized web browser.

That being said, because CHM is an old format and seemingly partially unsupported now, you can generate the same file based on the reversed engineered specification that the CHM files follow. Furthermore, because CHM is merely a binary file format emcompassing HTML files, encoding the HTML files using UTF-8 will accomplish getting the help documents themselves in whichever language you desire.

There is no Microsoft-supported CHM .NET API, so you'll have to output the Binary yourself using Streams / BinaryWriter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文