Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'd like to send a direct English death message to the clients instead of a key.

 

My use case:

I have a basic combat tagging mod, which is already working with the internationalized key being sent to the client and being re-localized client-side with the lang file, however...

1. The only thing this mod does on the client side is translate the death message key using the lang file, nothing else happens client-side

2. I'm already sending direct English chat messages for when players enter/leave combat.  Maybe those could be programmed to work with internationalization as well, but...

3. I'm not likely to ever add any languages to this mod; it's not a necessity.  In the end, a death message is a death message, and even if you can't understand exactly what it says (due to having a different native language), you'll recognize it (and even the cause of death) once you're used to seeing it.  Same goes for the enter/leave combat messages.  They have square braces and are color-coded.  I could make the text for them say "h9fkjehfkajn" and everyone would still figure out what they mean.  If I make a CONTENT mod, I will most certainly use internationalization methods, but this is not a content mod.  It's a utility.

 

If I can de-internationalize the death message being sent from the server to the client, I can make my mod server-side only, instead of requiring clients to have it installed just because the death message spits out an ugly keycode.  This will increase its utility value.

 

 

 

As a side note, wouldn't the internationalization system be better if it used one native language's actual message AS the key, instead of "death.attack.whatever"?  Isn't it basically the exact same thing, other than being a proprietary string instead of one chosen by the mod programmer?  Ie. couldn't it work the same if I simply sent "%s was smote for their cowardice!" from the server to the client, and on the client side, the lang file for a different language contained this:

"%s was smote for their cowardice!"="%s <enter foreign translation here>!"

Given that the internationalization backend were programmed to accept that format?

 

Wouldn't the only difference between that and the current system be that if the key was not present on the client, it would use the English string with a real meaning ("was smote!") instead of a string that looks like code?

(The concatenation the backend system uses to construct said keys could still be used as-is; it would just need one more very basic layer in between those keys and the system I'm talking about)

 

 

/rant

Anyway, if someone knows a good way to intercept and alter this "death.attack.smite" string before its send off to the client, I'd greatly appreciate it.

Prepared to take a bit of criticism as well, but I don't see a real down side to my proposition regarding how internationalization is handled.

Edited by Laike_Endaril
[SOLVED] tag

  • Author
5 minutes ago, diesieben07 said:

And once you need to change the English text, you need to change all your language files. Nope, not a good idea.

The way I was thinking of it, I'm fairly sure that would not be the case, but I could be wrong.  I might dig into the backend classes and look through them more later.

 

9 minutes ago, diesieben07 said:

You can override DamageSource#getDeathMessage to control the ITextComponent that is sent to the client.

Thank you!  I was looking way too deep into the system, as I tend to do.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.