Hello, I am trying to figure out the best way of adding multi language to my app, i was thinking of adding all buttons/UI text to dictionarys, and use the language as key, or having different xml/txt and use the current language for path for each xml/txt. can i get some advice? maybe suggest a third way of doing this? is there any default way of doing this?
What I did is: I have folders (in streaming assets, so languages can be added in build) for each language, and these contain a key=value dictionary files. On runtime, a selected language file is loaded (and actual Collections.Dictionary created). In code, I have a language class that lets me either find a value for the key, or replace key markers in a text (which is an extra feature you may not need)
Then I have a UI script I place under UI.Text, containing the key. It’s hooked to the Language’s change callback/event, so when a new language is loaded on runtime, the text of the UI is changed immediately.
Hello, @xxmariofer!
I think that way with xml/txt is fine!
something like
text1=Play
text2=Exit
text3=Press Play to start
Or another way - create scriptable object with attributes and then fill it.
One nice bonus is that you can create different scriptable objects for different stuff. Like one scriptable object for text UI in scene1, then another scriptable object for text UI in scene2 and so on. It would be easy to edit later. Also you can organize it like folders in your project!
[language]
-english
–scene1
—UI
—Quests
–scene2
—UI
—Quests
and so on