Inform 7 可以实现国际化

发布于 2024-10-21 04:55:53 字数 99 浏览 0 评论 0原文

如果我希望我的故事能够以多种语言播放,是否有任何方法可以从故事中“提取”文本,以便将其翻译成英语以外的语言?

我想到的是类似于 java web 应用程序中的属性文件。

If i want my story to be playable in diverse languages, is there any way of "extracting" the text from the story in order to translate it to languages other than english ?

What i am thinking of would be something like the properties files in java web applications.

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

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

发布评论

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

评论(1

动次打次papapa 2024-10-28 04:55:53

并不真地。 Inform 7 编译器本身会执行一些操作:当它将代码转换为 Inform 6 时,它会在生成的代码中提取所有字符串文字作为 Constant 指令。但编辑生成的代码只是自找麻烦,除非你百分百确定游戏已经完成并且永远不会再在 I7 中进行编辑。

您可以尝试通过将所有字符串文字移动到替换短语来手动国际化游戏。因此,

Home is a room. "This is your house."

您可以:

Home is a room. "[home description]".

To say home description: say "This is your house."

然后您可以将所有这些“要说”的定义放入扩展中,并通过创建扩展的翻译版本来本地化游戏。

但是,这些替换仅适用于输出。要国际化与玩家输入匹配的文本(例如对象名称、主题和动词语法),您需要将相关定义和规则移至扩展中。

例如,对于对象名称:

[in the main game code]
The widget is a thing. It is privately-named.

[in the English extension]
Understand "widget" as the widget.

请注意使用“privately-named”来阻止 Inform 在匹配玩家输入时使用对象的源代码名称,因为您不希望英文名称在翻译后的游戏中匹配。

Not really. The Inform 7 compiler does some of this itself: when it translates the code to Inform 6, it pulls out all the string literals as Constant directives in the generated code. But editing the generated code is just asking for trouble unless you're 100% sure that the game is finished and will never be edited in I7 again.

You could try internationalizing the game manually by moving all the string literals to substitution phrases. So instead of:

Home is a room. "This is your house."

You'd have:

Home is a room. "[home description]".

To say home description: say "This is your house."

Then you can put all those "to say" definitions in an extension, and localize the game by creating translated versions of the extension.

However, these substitutions only work for output. To internationalize text that's matched against player input -- such as object names, topics, and verb grammar -- you'll need to move the relevant definitions and rules into the extension.

For example, for an object name:

[in the main game code]
The widget is a thing. It is privately-named.

[in the English extension]
Understand "widget" as the widget.

Note the use of "privately-named" to stop Inform from using the object's source code name when matching player input, since you don't want the English name to match in the translated game.

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