Unreal Engine 4 has a very nifty localisation dashboard, which, once activated, does a lot of the heavy lifting when it comes to localising your game. With it you can gather all the texts in your game from folders you’ve selected and create a robust localisation using .PO files. There are a couple of caveats I learned the hard way.
For a start, if you are using localised graphics you need to reload the level you’re currently in for them to take effect (or they won’t take effect until you’ve changed your level). Secondly, it doesn’t gather all texts in your BluePrints unless you make sure to use variables or “make literal” nodes.
Though for Piczle Cross Adventure I’ll be using UE4’s own system for most of the interface but because the dialogs and books in-game could cause a localisation nightmare I’ve decided to build a system specifically to localise those slightly differently.
Dialogs each have a unique ID, and aside from stating the text, which character image to show with it, whether it’s a Yes/No option dialog, it also contains which dialog comes next, if any. If there is a next dialog after the current one, that dialog’s ID will be added, so after the player is done with the current one, it’ll automatically continue on to the next one. This way I can easily string together a lot of dialogs to appear one after the other.
SCORE1 -> SCORE2 -> SCORE3 -> END
One main reason I decided to do it this way is exactly because of localisation. Dialogs are stored in a datatable. Instead of localising that datatable I can have one for each language. That means each localiser is free to lengthen (or shorten) any of the dialogs as their language requires, because all the game looks at is IDs.
SCORE1 -> SCORE2 -> SCORE3-> SCORE4extra -> END
All I need to do at the dialog stage in the game is grab the correct datatable, and for that I have made a simple function, that looks at the selected language and sends back the appropriate datatable. Instead of telling a node to use a particular datatable, I have a function that checks which datatable I am looking for, check what the selected language is, and then sends back the datatable for the thing in the correct language.
Similarly the books in the game are made up of pages. Each page has the text, title and an optional image to show. Each book is made up of a set of pages. So if a language requires more pages to fit the same information, localisers are free to just add those pages when they write, and then add the extra IDs in the book datatables.
The final thing to do is to keep all these script files (datatables) in a separate folder to easily exclude them from UE4’s own localisation text gathering.
Localisation is a tough, demanding and difficult job at the best of times. Having a fairly restrictive text system like Piczle Cross Adventure’s character-limited dialog system, as described in a previous post, makes it even harder. This was the main motivator to create a more flexible ID-driven system. What a Japanese localiser could fit in a single dialog box, a German one may need 5 for, and this system allows each region to have its own, unique dialog/books datatables and use as much space as they need with no game-breaking consequences!