![]() |
Convenient localization - Printable Version +- Gothic Online Forums (https://archive.gothic-online.com) +-- Forum: Scripting (English) (https://archive.gothic-online.com/forum-11.html) +--- Forum: Tutorials (https://archive.gothic-online.com/forum-13.html) +--- Thread: Convenient localization (/thread-2012.html) |
Convenient localization - Osmith - 03.03.2017 Hi. Now I will tell you how to do a simple localization for the server without the use of too large code. First create an array or table with the desired languages. I have this RU, PL and EN. Code: local translation = []; Then add in the table new item - the same table, but now with two fields - text and x. Text is a string and x is a number. Yet will leave them empty. Code: local translation = []; The text field is directly is our translation, and the x - offset the x coordinate. The same words in different languages can occupy different space, so we need to have everything in its place. For example, take the word "Hi". Code: local translation = []; We see that the English word "Hi" is shorter than Russian or Polish, so we do the offset. I don't have exact coordinates, so we imagine that we enter our text in the button, and make the shift to the left. Code: local translation = []; Now that we have the translation, add it to our array. Code: local translation = []; Now that we have the translation, let's send it to a file with our GUI. Code: local translation = getTranslation(); Now make a function to calculate the current language of the user, which is installed in the launcher. Code: local translation = getTranslation(); Now that we have the translation, information about the language and the offset - you can add it in our texts. Code: local translation = getTranslation(); That's about it. If you have any comments, questions, or suggestions, write them here, please. Also ready to answer all GG: 60474243 An example of the translation: ![]() ![]() |