Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
导入翻译
游戏与国际化
游戏社区不是单一语言或单一文化的。它由许多不同的语言和文化组成 - 就像 Godot 社区一样!如果你想让玩家用他们的语言体验你的游戏,你需要提供的其中一件事就是文本翻译,Godot 通过国际化文本支持文本翻译。
在常规的桌面或移动应用程序中,国际化文本通常位于资源文件中(GNU 内容则是 .po 文件)。然而,游戏可以使用比应用程序多几个数量级的文本,因此它们必须支持能高效处理多语言文本加载的方法。
有两种方法来生成多语言的游戏和应用程序。两者都基于键值对系统。第一种是使用其中一种语言作为“键”(通常是英语),第二种是使用特定的标识符。如果首先用英语发布游戏,后来以其他语言发布游戏,则第一种方法可能更易于开发;但是如果同时使用多种语言,则完全是一场噩梦。
一般来说, 游戏使用第二种方法, 并为每个字符串使用唯一的ID. 这允许你在翻译为其他语言时修改文本. 唯一ID可以是数字, 字符串, 或带有数字的字符串(无论如何, 它只是一个唯一的字符串).
Supported formats
To complete the picture and allow efficient support for translations, Godot has a special importer that can read CSV files. Most spreadsheet editors can export to this format, so the only requirement is that the files have a special arrangement. See Localization using spreadsheets for detailed info on formatting and importing CSVs.
如果你需要更强大的文件格式,Godot还支持加载以gettext .po
格式编写的翻译. 有关详细信息, 请参见 Localization using gettext (PO files).