AgriCraft

AgriCraft

30M Downloads

Magnifying Glass has unlocalised strings in server

Nox13last opened this issue ยท 2 comments

commented

Quick description

When using the Magnifying Glass, unlocalised strings appear in chat. For example, instead of "Growth: [10/10]", it will say "{*agricraft_tooltip.growth*}: [10/10]". In the header, instead of saying "Magnifying Glass", it will say "{*item.agricraft:magnifying_glass.name*}"
Client language is EN-GB, but issue is also present on EN-US and EN-NZ.
The issue does not occur in Single-Player.
Not all strings are unlocalised. For example, the "Brightness" string is localised appropriately.

Related issues and searches

Keywords: Unlocalised Unlocalized String Tooltip Magnifying Glass Magnifier

  • I couldn't find any examples of this happening in the Issue box.

Mods and versions used

Agricraft version: 2.12.0-1.12.0
Minecraft version: 1.12.2
Forge version: 14.23.5-2838
FML version: 8.0.99.99
Infinitylib version: 1.12.0.jar
All mods other than those listed above were removed for repro.

Steps to replicate the issue

  1. Log in to server.
  2. Get Magnifying Glass item
  3. Right-click a thing with Magnifying Glass

Expectations and explanations

I shouldn't have to fill this bit out, to be honest.

Your environment

  • How are you playing?
    • Operating System: Windows 10
    • Launcher: Technic Launcher
    • Modpack: Private modpack - SpongeForge
  • What kind of server:
    • Singleplayer
    • Multiplayer
  • Game Modes:
    • Survival
    • Creative
  • Save File:
    • Brand new save
    • Only an existing save

Links to crash logs, stack traces, etc

No server log event happens on using the Magnifying Glass.

Screenshots (or videos)

image

commented

So I did some looking into this one. This bit is happening on the server, so the keys aren't being localized before they're put into a list of strings and sent to the client as chat messages.

https://github.com/AgriCraft/AgriCraft/blob/master/src/main/java/com/infinityraider/agricraft/items/ItemMagnifyingGlass.java#L77

What could be done is to use TextComponentTranslation instead of TextComponentString, but that would only work on direct keys. The trouble is they're already assembled as larger strings by this point, and not just in this class. There's also strings being generated from the block and tile entities via IAgriDisplayable. That makes separating out the keys a lot harder without rewriting how the whole thing works.

I'm not sure the whole AgriTranslator system is actually necessary anymore. I think it could be ripped out and standard Forge functions used in its stead. But that's a bigger task, and maybe it's needed for something that I'm missing.

commented

Closing since we are moving to 1.16.