Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation for labels #51

Open
sigangzzang opened this issue Jan 22, 2021 · 14 comments
Open

Add translation for labels #51

sigangzzang opened this issue Jan 22, 2021 · 14 comments

Comments

@sigangzzang
Copy link

using very usefully localizer mod. thx to childeren team. but github wiki page has no explanation in English, so couldn't understand for half ldstr file, and couldn't find the translation of labels in mods any json files.

@sgkoishi
Copy link
Member

The ldstr file is extracted from the mod's code - every item in this file is presented in the source code.
It's impossible to explain each item inside since every mod author may code differently.
If you need help with a specific mod, please add more details.

@sgkoishi
Copy link
Member

If you would like to go into a bit tech-related, the following part is here.
The content of ldstr file is a dictionary of Method Signature and the text inside that method. Method Signature is something looks like ReturnTypeNamespace.ReturnType Namespace.Class::Method(Arguments)
For example, System.Void CalamityMod1.CalamityMod2::Load()

  • ReturnTypeNamespace.ReturnType: System.Void
  • Namespace: CalamityMod1
  • Class: CalamityMod2
  • Method: Load
  • Arguments: empty

Here are some common patterns:

Namespace and Class Method Arguments Description
(any) ModifyInterfaceLayers (any) Custom UI. If you change the text here, you'll 99% lose a UI. It vanishes. DO NOT TOUCH.
Mod Name Load () Initialization. Probably the hotkey setting is here.
xxxx/<>c xxx () Custom recipe group (for example, any wood)
xxxx/<>c xxx (Terraria.World.Generation.GenPass) Custom map element. If you change the text here, you'll 99% lose some mod-unique environment or items. DO NOT TOUCH.
xxxx/<>c xxx (Terraria.World.Generation.GenerationProgress) Custom map generation text, used to be displayed during world generation.
xxxGlobalNPC GetChat (Terraria.NPC,System.String&) Update the chat of a NPC vanilla or in other mod.
GetChat () Chat of NPC
TownNPCName () Possible names of NPC
AI () AI
SetChatButtons (System.String&,System.String&) Special text when you chat to certain NPC.
NPCLoot () Loot.
xxxGlobalItem ModifyTooltips (Terraria.Item,xxxxxx) Update the tooltip of items vanilla or in other mod.
ModifyTooltips Update tooltip.
UpdateArmorSet (Terraria.Player) Set bonus
SetDefaults () Initialization of items/NPC/projectiles.
MouseOver or MouseOverFar Mouse over.

[i:xxx] is the code when you send an item in chat. It was usually split into [i: and ].

@sigangzzang
Copy link
Author

Thanks for the quick reply.
I will follow the attached explanation.

As an example, can i find the config contents of the calamity mod in the ldstr file? (calamity mod config writen is 'lables', i don't find. sry)

@sgkoishi
Copy link
Member

Thanks for the quick reply.
I will follow the attached explanation.

As an example, can i find the config contents of the calamity mod in the ldstr file? (calamity mod config writen is 'lables', i don't find. sry)

Could you take a screenshot of what you want to change?

@sigangzzang
Copy link
Author

And there is a small bug in the translated mod. In the case of a mod that loads and uses a mod that has been translated, problems such as a game freeze or deletion of a recipe occur.

This can be solved by manually adding the mod loading mod you are using to the localizer temporarily.

Where can I quickly contact to questions or send screenshots? Is there a Discord to Children's Team?

@sigangzzang
Copy link
Author

sigangzzang commented Jan 22, 2021

Q1. How to translate calamity mod config options?
2
3
Here's what I said 'label'

@sigangzzang
Copy link
Author

sigangzzang commented Jan 22, 2021

Q2. Problem with mods loading translated mods

Case 1
2
magic storage mod is translated.
RecipeBrowserToMagicStorage mod make some freeze game
(Manually adding the RecipeBrowserToMagicStorage mod has fixes it.)

Case 2
3
Calamity mod is translated.
FargowiltasSoulsDLC mod Recipe is broken.
Even if there is no material, it is just made it.
(Manually adding the FargowiltasSoulsDLC mod has fixes it.)

What I want to say is you have to manually export that mods in which the problem occurs and then add it.

example
4
5

@sgkoishi
Copy link
Member

Q1: The ModConfig part is not supported yet - and yes, it's not in the ldstr file. Probably update after tML 1.4 release.

Q2: You may upload the log file (%UserProfile%\Documents\My Games\Terraria\ModLoader\Logs) to help diagnose the problem if you don't mind.
I've heard about some similar problem (freezing) about using translated Thorium and FargowiltasSouls together. Since ldstr is changing the code of the mod, some cross-mod content is broken since it still uses the original mod instead of the translated version. (e.g., the recipe requires "Mod A Item B", but Mod A no longer exist - there is translated Mod A)
Possible solutions:

  • Open (GameDirectory)/Localizer/Config.json, change the "ImportLdstr": true, to "ImportLdstr": false,
    By doing so you disable the ldstr import completely so that the mod will always be the same one. Other features like BasicFiles still works correctly.

or

  • Open (GameDirectory)/Localizer/Config.json, change the "LdstrImporter": "Cecil",
    • You may change Cecil into Harmony or MonoMod.
      Those are different technics to import the ldstr update, but they work differently. They do not replace the whole mod with a new version, but only change the necessary parts. They have better compatibility but less effective. For example, some special strings will remain original even if translated (the original version loaded before translation load).

Or, you can wait till tML 1.4 and see if someone will update it, add fixes and new features

@sigangzzang
Copy link
Author

sigangzzang commented Jan 22, 2021

2
Ah! I will understand and wait.
I was curious as some mods even now can translate option config with localizer.
Thank you so much for answering :)

It's okay to upload the log file, but it won't work as the game isn't crashing.

  • not crashing. it's just freeze. still playing music, but can't do anything.
  • it's have to force it to quit.
  • The way you told me or the way I told you can solve it, but the problem is that it can be exploited in multiplayer
  • You can ignore and exploit server management tools like server side character or Hero's mod.

You can test it by following case 1 or 2 attached above.
Hope this will be solved by waiting for a new version of tml and localizer, sir.

And if you okay, can you tell me more about change ldstr importer?
The difference between each method and if the person who translates it changes and applies it, the person who downloads it also changes?

@sgkoishi
Copy link
Member

Sorry, what did you mean by exploit?
Localizer is a local mod that does not synchronize with the server - which means you can enable/disable it no matter if the server installs/enable it.

@sigangzzang
Copy link
Author

sigangzzang commented Jan 22, 2021

Sorry, what did you mean by exploit?
Localizer is a local mod that does not synchronize with the server - which means you can enable/disable it no matter if the server installs/enable it.

i know :), Since it is in local mod, it is very advantageous to be able to translate regardless of the server, so I too use a localizer.

  • It means making an item right on the altar as soon as some people start the game.
  • As you said, it's in local mod, so I can't cope with this.
  • In the case of Case 2 mentioned above, can always create items at will by temporarily disabling the translation of the DLC mod. (by individual)
  • talking about when playing multiplaying.

@sgkoishi
Copy link
Member

Sorry, what did you mean by exploit?
Localizer is a local mod that does not synchronize with the server - which means you can enable/disable it no matter if the server installs/enable it.

i know :), Since it is in local mod, it is very advantageous to be able to translate regardless of the server, so I too use a localizer.

* It means making an item right on the altar as soon as some people start the game.

* As you said, it's in local mod, so I can't cope with this.

* In the case of Case 2 mentioned above, can always create items at will by temporarily disabling the translation of the DLC mod. (by individual)

* talking about when playing multiplaying.

I see - that's kinda serious. I'll try to reproduce and find some way to fix it.

@sigangzzang
Copy link
Author

sigangzzang commented Jan 22, 2021

Okay. All of my questions have been resolved,
Should I close this issue?
or just leave it?
I'll just leave it if you can close it later

@sgkoishi
Copy link
Member

The sgkoishi-patch-1 branch should hopefully fix the broken recipe problem. It's not a good or smart solution but probably just works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants