How to create a Multi-Language Game (menu)

  • #1, by anna-arnoldSaturday, 17. June 2017, 08:17 7 years ago
    Hello, I'd like to ask how you do the menues  for a Multi-Language Game. I'm not sure how to make it.

    Newbie

    95 Posts


  • #2, by ke4Saturday, 17. June 2017, 09:38 7 years ago
    You probably could do an objects both for original a translated texts. Then you will gonna need some condition and set it to the objects. You can reverse it for the translated texts so eiter one or the other language is gonna be shown.

    Now the tricky part: You will have to use the config.ini file ( or well any other file ) as you can't relly here on the save data and you need to store the information somewhere else. And that's what's config.ini for.

    What you need then is to learn how to write and read from a file in Lua. If you change the language in the menu you would write that in the config.ini file. Something like language = english.

    Then on the reading part ( a script that will run on the game start ) you would read the config.ini file and based on the information set the language condition.

    There's an example script from AFRLme on the Visionaire wiki, but you don't need it that complicated just for setting a language.



    local file = io.open(localAppDir .. "config.ini", "r")
    
    
    for line in file:lines() do
        if string.match(line, "language") then
            if string.match(line, "english") then
                game.StandardLanguage = Languages["english"]
                Conditions["menuLanguageOriginal"].ConditionValue = false
            end
        end
    end

    Key Killer

    810 Posts

  • #3, by anna-arnoldMonday, 19. June 2017, 13:35 7 years ago
    Oh okay, now I see what you mean. The Config.ini is not that complicated as I thought. grin

    I think I got the Idea. Thank you.

    Newbie

    95 Posts

  • #4, by afrlmeMonday, 19. June 2017, 13:43 7 years ago
    Oh okay, now I see what you mean. The Config.ini is not that complicated as I thought. grin

    I think I got the Idea. Thank you.
    Just edit the config.ini script I wrote & shared on the wiki. It's a reference template, so you can't just use it as it is, but there's instructions on the page to go with it. wink

    & bloody menus... always the most time consuming, mundane part of game development when it comes to Visionaire Studio.

    Imperator

    7278 Posts