如何本地化 autorun.inf?
有人成功创建了单页 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
卡萨布兰卡在评论中链接的文档告诉我们这必须如何完成,但是要以迂回的方式完成。
答案就在“间接字符串”中。您必须向 EXE 或 DLL 文件添加多个字符串资源,所有资源都具有相同的 ID,但指定不同的语言(通过 LANGUAGE 语句)。然后您可以在 autorun.inf 中引用这些字符串 文件通过间接字符串语法:
@filename,-id
间接字符串的语法是
@
符号,后跟包含该字符串的文件的名称您正在引用的资源,后跟一个逗号、一个减号,然后是您正在引用的字符串 ID。示例:
这要求您的 EXE 中有一个包含所有本地化字符串的字符串表资源。在 RC 文件格式中,它可能如下所示:
如果用户安装了德语版本的 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 theautorun.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:
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:
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.