Hello
I’m making a game, but when I decide to make menu, I found that I will attract more people if the game has multilanguage. But I don’t know how to made a fonctionnal language setting.
Can you help me?
Hello
I’m making a game, but when I decide to make menu, I found that I will attract more people if the game has multilanguage. But I don’t know how to made a fonctionnal language setting.
Can you help me?
It’s a bit of work, but none of the steps are too difficult. Just take 'em one by one…
Create a CSV file where the first column is a unique key for each string in your game, and the subsequent columns are the corresponding text in different languages. (And maybe in the very first row, each column after the first contains the language code that it represents.)
Write (or find) C# code to parse a CSV file. You probably want to store it in something like a Dictionary<string, Dictionary<string, string>>, where the first key is the language code, and the second key is the string key. So for example data[“en-US”][“mainmenu”] would return the text for “Main Menu” in US English.
Make a singleton script to wrap a PlayerPrefs setting for the current language.
Make a little script you put on each UI.Text object (etc.) that knows the key (e.g. “mainmenu”) for the text it should display, and gets the current language key from step 3, and looks up the corresponding text in the data from step 2.
That’s pretty much it. I’ve done this on several games, and it works great — and you get this nice CSV file you can send to your translators, who will immediately know what to do with it. (To really help them out, you might include a final column that a comment, used to provide more context to the translators so they can be sure what each item is supposed to mean.)
Thank for your help