• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

tModLoader ModLocalizer - A tool to create localization for tModLoader mods

mistzzt

Terrarian
Mod localizer is a tool developed for players to create their own localized mod easily; it support mods of tModLoader v0.10 or higher version.

Introduction
As far as we know, tModLoader has added a new feature enabling mod to have its translations. However, it cannot be easily used since it needs you to know how to code and it only works with open-source mod.

But this tool solves these problems of tModLoader's internationalization feature:

  • It can read .tmod files and generate game content (like item names, tooltips and buff descriptions) in JSON format in which format you can translate them into your language with comfort.

  • After your translating, the tool will use your translation to modify contents inside .tmod files regardless whether it is open source by changing and emitting IL codes in DLLs.

  • It doesn't require programming knowledges; all you have to know is how to use command line and edit files using editors like VSCode.
Usage
ModLocalizer --mode dump <Mod Name>
Example: ModLocalizer --mode dump ExampleMod.tmod

Program will create a new folder which name is the same as that of mod file and output mod contents inside it.

ModLocalizer --mode patch --folder <content path> --language <language> [Mod file]
Example: ModLocalizer --mode patch --folder ExampleModContent --language Chinese ExampleMod.tmod

Modify ExampleMod.tmod according to contents in ExampleModContent folder.

The folder option is mandatory when the program mode is patch, because program needs it to modify mod file.

You have seven languages for chosing:

  • English
  • German
  • Italian
  • French
  • Spanish
  • Russian
  • Chinese (This is default language if you don't specify one using --language)
  • Portuguese
  • Polish
They're case-sensitive: you must enter them as what exactly they are here (also without spaces).

If I chose Chinese, then my translations will only show when I use Chinese language in Terraria Settings. So you must carefully choose your language to let your translations work.

After executing, program will generate a file ends with _patched.tmod in your current directory.

For further usage, enter ModLocalizer --help.

How to translate mod content
You might get something like this when translating mod:

Code:
{
"TypeName": "DO-NOT-EDIT-ME", // DO NOT EDIT THIS
"Namespace": "DO-NOT-EDIT-ME", // DO NOT EDIT THIS
"Name": "Example Breastplate",
"ToolTip": "This is a modded body armor.\nImmunity to 'On Fire!'\n+20 max mana and +1 max minions",
"ModifyTooltips": []
}
You can modify anything except TypeName, Namespace, Method and Value.

I recommend using Visual Studio Code as your editor.

File/Directory inside mode content folder
  • Info.json contains build properties like mod version and descriptions.

  • ModInfo.json contains properties of *.tmod files like mod name or version.

  • Items contains item properties like item name and tooltip.

  • NPCs contains NPC properties like name, chat texts and shop button texts.

  • Tiles contains map entries which need to be translated.

  • Miscs contains some other texts.

Repository page: https://github.com/mistzzt/tmodloader-mod-localizer
Download: https://github.com/mistzzt/tmodloader-mod-localizer/releases
 
Last edited:

Flashkirby99

Skeletron
Great work, I imagine people will be able to localise mod far more easily with this, especially if you can't get ahold of a mod owner for any reason.
(also Atom and Notepad++ are also great text editors)
 
Whenever I open the .exe file, it immediately closes. Any tips to fix this?
You need to made a shortcut of .exe file and go to properties of shortcut. Then in the way to the .exe file add this :
1. --mode dump <Mod Name> : That's will make a new folder with all files what can be translated from the mod what you selected and put instead of
<Mod Name>. Example: --mode dump ExampleMod.tmod.
2a. If you made a translation, you need to save the file and convert to .tmod file.
You need in the end add this, but you need delete this line : --mode dump ExampleMod.tmod.
2b. --mode patch --folder <content path> --language <language> [Mod file]
Example : --mode patch --folder ExampleModContent --language Chinese ExampleMod.tmod
That's all ;)
 

❤Putin❤

Terrarian
You need to made a shortcut of .exe file and go to properties of shortcut. Then in the way to the .exe file add this :
1. --mode dump <Mod Name> : That's will make a new folder with all files what can be translated from the mod what you selected and put instead of
<Mod Name>. Example: --mode dump ExampleMod.tmod.
2a. If you made a translation, you need to save the file and convert to .tmod file.
You need in the end add this, but you need delete this line : --mode dump ExampleMod.tmod.
2b. --mode patch --folder <content path> --language <language> [Mod file]
Example : --mode patch --folder ExampleModContent --language Chinese ExampleMod.tmod
That's all ;)
Thank you.
 

AA^2

Terrarian
C:\Users\sword\Desktop\Mod.Localizer_0.2>C:\Users\sword\Desktop\Mod.Localizer_0.2\Mod.Localizer.exe --mode dump C:\Users\sword\Desktop\Mod.Localizer_0.2\CalamityMod.tmod
10:44:23 |Debug |Mod.Localizer.Program |Mod.Localizer started. (v0.2.0.0)
10:44:23 |Error |Mod.Localizer.Program |Unhandled Exception
================
2020/1/22 上午 10:44:23: Unhandled Exception
Culture: zh-TW
Exception: System.Reflection.TargetInvocationException: 引動過程的目標傳回例外狀況。 ---> System.IO.EndOfStreamException: 無法讀取資料流末端之外。
於 System.IO.BinaryReader.ReadString()
於 Terraria.ModLoader.IO.TmodFile.Read(LoadedState desiredState, ReadStreamingAsset streamingHandler)
--- 內部例外狀況堆疊追蹤的結尾 ---
於 System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
於 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
於 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
於 Mod.Localizer.TmodFileWrapper.TmodFileImplementation.InvokeMethod[T](Object instance, String method, Object[] parameters) 於 C:\Users\zitwa\Sources\Repos\tmodloader-mod-localizer\Mod.Localizer\TmodFileWrapper.cs: 行 178
於 Mod.Localizer.TmodFileWrapper.TmodFile.Read() 於 C:\Users\zitwa\Sources\Repos\tmodloader-mod-localizer\Mod.Localizer\TmodFileWrapper.cs: 行 258
於 Mod.Localizer.TmodFileWrapper.LoadFile(String path) 於 C:\Users\zitwa\Sources\Repos\tmodloader-mod-localizer\Mod.Localizer\TmodFileWrapper.cs: 行 31
於 Mod.Localizer.Program.Process() 於 C:\Users\zitwa\Sources\Repos\tmodloader-mod-localizer\Mod.Localizer\Program.cs: 行 37
於 Mod.Localizer.Program.Main(String[] args) 於 C:\Users\zitwa\Sources\Repos\tmodloader-mod-localizer\Mod.Localizer\Program.cs: 行 269
================


這個錯誤 該如何解決?
 
Top Bottom