Toukibi / ToSAddon

Add-ons for Tree of Savior
GNU General Public License v3.0
11 stars 9 forks source link

Better translations for all addons #10

Closed xZeroW closed 7 years ago

xZeroW commented 7 years ago

Everything is adjusted. I'm trying to add pt_br translations too, I just need to learn how to pack the ipf file. The translations.txt files has some messages used in your add-ons.

Toukibi commented 7 years ago

Thank you for your quite many correction. In fact I thought that I could push "Review changes" to each file one by one, but as I approved it all in one stroke, please wait for the merging of the branch for a while.

And the correction of translation has been a great learning experience for me. Again thank you.

xZeroW commented 7 years ago

Glad I can help. I've learn some things too while translating those addons. I learned how to pack the addons, but I don't understand how to add one more language to the code, When I try to add one more language the addon don't load. If you want to add pt_br mode too, I'll be happy to send you a text file with all translations. Thanks for the amazing addons. :)

Toukibi commented 7 years ago

I'm sorry for being late. I'll explain how to add another language mode to my add-on.

First of all, we must write to the source of add-on that the add-on supports the target language. The presence or absence of implementation is judged based on whether the corresponding language code exists in Toukibi.CommonResText. For example, if it is MapMate.lua, it exists near line 187.

-- コモンモジュール(の代わり)
local Toukibi = {
    CommonResText = {
        jp = {
            ...
        },
        en = {
            System = {
                ...
            },
            Command = {
                ...
                },
            Help = {
                ...
            }
        },
        kr = {
            ...
        },

        -- If you want to add pt_br mode as `/mmate br`, you should write as shown below:
        br = {
            ...
        }
    },

Within the Toukibi.CommonResText, there must be no blank items for the en block. (Actually, there is no problem if blank complementation is done in jp block, but for IToS there is no Japanese font, so all parts of Japanese will be displayed in dot.) Blocks in other languages Even if there is a blank item, there is no problem. Blank items may be written as '= nil', and it is okay not to declare itself.

After that description, add , br = 'items to ResText and CommandParamList. Then, I think language will switch normally.


Postscript: Specification for loading language resources Reading language resources is done with Toukibi.GetResData near line 305. The text of the resource is read in the order of specified language > English (en) > Japanese (jp). When there is no corresponding resource in any of the three, <No Data !!> will be displayed. That's why CommonResText blocks other than en may have white-space.

xZeroW commented 7 years ago

Actually I have made this before but I can't get it to load ingame. This is what I did: shophelper.txt Did I miss something?

Toukibi commented 7 years ago

I also checked on my side. Then I noticed that there was one mistake in line 586.

Before correction:

else option.GetCurrentCountry() == "English" then
    return "en";

After correction:

elseif option.GetCurrentCountry() == "English" then
    return "en";

Therefore, it seems that syntax error occurred and did not load the changed program. However, Since the GetDefaultLangCode procedure is provided to distinguish between IToS or JToS or KToS, I recommend that you do not change it if possible.

Toukibi commented 7 years ago

As for the setting screen of ShopHelper, it is a little complicated processing, so it is OK only text resource part, so if you send it I think that I will implement the installation work. For other add-ons, you can either send a pull request or send only the text resource portion.