LOCALIZATION SYSTEM - PART 2
Author: cevozby,
published 9 months ago,
Last week I introduced the localization system, this week I am continuing where we left off. First of all, I would like to announce that the localization system is almost finished, only minor adjustments are left. I will continue to talk about this process.
Last week I talked about the differences between static text and dynamic text. To remind you, static text is the text that stays fixed and unchanged throughout the game, while dynamic text is the text that changes at the start of the game or during the game depending on the situation.
[h2][b]Static Text[/b][/h2]
Static texts are very easy to change, I assign a key and its equivalent in that language as a value and assign these keys to the texts. Then the texts change automatically when the player switches languages.
[img]https://clan.cloudflare.steamstatic.com/images//44297973/0ace37c829d9fdbdc34198417296fcc011f5feb6.png[/img]
[b][h2]Dynamic Text[/h2][/b]
Dynamic texts cannot be set at the beginning because the text content changes in the game. In such texts, the key is set, but it varies in the value part. In dynamic text, there are parts that are fixed and parts that can change. For example, let's take the message for the result of the battle, the celebration part is fixed, but the date, result, score, etc. change according to the result of the match.
[b][h2]How to Localize Dynamic Text[/h2][/b]
Unity has a system for this (thank God), where you specify the parts of the text to be changed by number in fancy brackets. For example;
"The {0} Clan has received {1} gold budget increase from the War League Council for the upcoming season."
[img]https://clan.cloudflare.steamstatic.com/images//44297973/6da2ca0b899c39a3e9f291d9a6a6ef6cb4589656.png[/img]
Here, the parts in fancy brackets are the parts that will be assigned values later. Here we write the values that will come from the code respectively. These are called arguments, for example in this example {0} is the clan name and {1} is the budget value assigned to the clan. These are collected in the argument and when the language changes, these values are retrieved from the argument.
This part was a bit tricky at first, but I got it done, but I'll talk about the most challenging part next week.