- Home /
The question is answered, right answer was accepted
adding localization
Hi, i've try to find it in documentation,but not found. What is correct way to add localization in game?
is possible use plain text or xml file to struct language words?
Answer by Mammoth · Oct 08, 2011 at 11:42 PM
There no native support for it. But it's not really a problem (flash has it, but it is too bad). Sure you can use plain text or xml (see TextAsset).
I'll tell you how it's done if there are separate game versions, one for each language. Store all your textures and sounds that need localisation in a separate folder, so you can quickly change them. Create some text manager, that maps string keys to actual text. In a simple project keys can be just strings ("buttonPlay" -> "PLAY"). For something more complex it's convinient to have "groups", i.e. group "main_menu", key "button_play", text "PLAY".
You'll need to think about dynamically generated strings i.e. "task progress: 2 out of 4 done". In some languages the order of 2 and 4 MUST be reversed, so it's better to have option to parse strings like "task progress: [2] out of [3] done" in a way like
string taskStr = Loc.GetStr("gamePanel", "task_desc");//that is "task '[1]' progress: [2] out of [3] done"
string parsed = Loc.Parse(taskStr, 2, 4);//"task progress: 2 out of 4 done"
Thank's,i've read TextAsset,but not understanding how to use. in documentation i've example only for TextAsset.bytes... Can add example for xml format? Is possible to use a table like xls or csv? my idea is addind text_default at frist colum the use other column to language translation. i haven't idea how to struct file contain definition word.
Follow this Question
Related Questions
Hindi characters not showing up in windows phone 8 1 Answer
Arabic/Hindi/etc support for Android? 0 Answers
How to preload language? 0 Answers
Changing asset path for localization support 1 Answer
iphone Language 1 Answer