如何本地化 autorun.inf?

发布于 2024-09-24 09:16:45 字数 417 浏览 4 评论 0原文

有人成功创建了单页 autorun.inf 文件吗? *.inf 文件的文档表明

[autorun] 
open="MyApp.exe"
icon=MyApp.exe,0
label=%AppLabel%
action=%AppAction%
[Strings]
AppLabel = "My test app"
AppAction = "Start my test app"
[Strings.0407]  ; 0407 is the language ID for German
AppLabel = "German my test app"
AppAction = "German start my test app"

应该可以工作。我发现该标签(如“自动运行”对话框中显示的那样)显示“%AppLabel%”,而不是预期的“我的测试应用程序”。

Has anyone successfully created a single page autorun.inf file? The documentation for *.inf files would suggest that

[autorun] 
open="MyApp.exe"
icon=MyApp.exe,0
label=%AppLabel%
action=%AppAction%
[Strings]
AppLabel = "My test app"
AppAction = "Start my test app"
[Strings.0407]  ; 0407 is the language ID for German
AppLabel = "German my test app"
AppAction = "German start my test app"

should work. I find that label (as it appears in the Autorun dialog) shows '%AppLabel%' rather than the expected 'My test app'.

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

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

发布评论

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

评论(1

不必你懂 2024-10-01 09:16:45

卡萨布兰卡在评论中链接的文档告诉我们这必须如何完成,但是要以迂回的方式完成。

答案就在“间接字符串”中。您必须向 EXE 或 DLL 文件添加多个字符串资源,所有资源都具有相同的 ID,但指定不同的语言(通过 LANGUAGE 语句)。然后您可以在 autorun.inf 中引用这些字符串 文件通过间接字符串语法:@filename,-id

间接字符串的语法是 @ 符号,后跟包含该字符串的文件的名称您正在引用的资源,后跟一个逗号、一个减号,然后是您正在引用的字符串 ID。

示例:

[autorun]
open="MyApp.exe"
icon=MyApp.exe,0
[email protected],-100
[email protected],-101

这要求您的 EXE 中有一个包含所有本地化字符串的字符串表资源。在 RC 文件格式中,它可能如下所示:

#include <winresrc.h>

LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
    100 "English MyApp
    101 "English MyApp description text"
END

LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
    100 "German MyApp
    101 "German MyApp description text"
END

如果用户安装了德语版本的 Windows,或者选择德语作为其 MUI 语言,则 Windows 应使用德语字符串。任何其他语言版本都应选择英语字符串。

The docs linked by Casablanca in a comment tell how this must be done, however in a roundabout way.

The answer is in "indirect strings". You must add multiple string resources to an EXE or DLL file, all with the same ID but different languages specified (by the LANGUAGE statement.) You can then reference those strings in the autorun.inf file by the indirect string syntax: @filename,-id

The syntax for indirect strings is an @ sign, followed by the name of the file containing the string resources you are referencing, followed by a comma, a minus, then the string ID you are referencing.

Example:

[autorun]
open="MyApp.exe"
icon=MyApp.exe,0
[email protected],-100
[email protected],-101

This requires you to have a string table resource in your EXE containing all the localised strings. It can look like this in the RC file format:

#include <winresrc.h>

LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
    100 "English MyApp
    101 "English MyApp description text"
END

LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
    100 "German MyApp
    101 "German MyApp description text"
END

Windows should then use the German string if the user has a German language version of Windows installed, or selected German as his MUI language. Any other language version should pick the English strings.

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