I implemented a new comfortable workflow for localization using the CastleLocalizationGetText unit. It is documented in details in the manual about localization and is demonstrated by a revised examples/localization/gettext/ demo.
It was tested by localizing to Japanese an upcoming release of “Escape from the Universe” on Nintendo Switch. I will make more news about the game itself later 🙂
Details of new localization features:
- Supports localizing user interface (designed using CGE Editor) really easily (just call TranslateAllDesigns). In more complicated cases, you have
TranslateDesign
orTranslateProperties
. -
It can generate GetText PO template files, to serve as immediate starting point for translators (use GenerateGetTextPo).
-
You can use CastleTranslateResourceStrings to translate strings declared in Pascal code as
resourcestring
. This is just a simple wrapper for FPCGetText.TranslateResourceStrings
(it understands CGE URLs, works on all CGE platforms including Nintendo Switch etc.). -
It’s extensible by overriding TCastleComponent.TranslateProperties. A single component can have multiple properties to translate (e.g. TCastleEdit has Text, Placeholder).
-
texture-font-to-pascal
tool gets additional command-line option--sample-get-text-mo
to add all characters mentioned in given GetText MO file.
Everything is documented, read and follow the links from our manual about localization.
P.S. In related news, the “Escape from the Universe” English version (for Europe and America) just passed the review by Nintendo, and it will be available on Nintendo Switch since August. I’ll post more information about it later 🙂 What it means for you is that Nintendo is completely fine with games being developed with Castle Game Engine 🙂