Jump to content

Recommended Posts

Posted

Thanks! What I want to do is have a few localisations such as metal.tin and metal.copper, and match them with component.plate and component.powder, so I can combine them to make Tin Plate, Tin Powder, Copper Plate, Copper Powder, etc.

Posted

Mixing and matching like that isnt advised because other languages have different syntaxes so its not always {Material} {Form}

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

What Lex says is very true, but don't let that discourage you - translations can be very flexible with just a little bit of formatting, as they ultimately use the Java Formatter class:

// Lang file:
yourmod.item.name=%s %s // results in "Tin Plate"
yourmod.metal.tin.name=Tin
yourmod.component.plate.name=Plate

// Item code:
@Override
public String getItemStackDisplayName(ItemStack stack) {
// Make sure to use #translateToLocalFormatted and pass the translations for each component as an argument
return StatCollector.translateToLocalFormatted(getUnlocalizedName() + ".name",
  StatCollector.translateToLocal("yourmod.metal.tin.name"),
  StatCollector.translateToLocal("yourmod.component.plate.name"));

Of course, it's up to you to determine which metal and component to use in the translation, probably using some kind of Object retrieved from NBT. But anyway, then languages with different ordering rules can translate it like so:

// taking advantage of Formatter syntax to re-order the arguments:
yourmod.item.name=%2$s %1$s  // results in "Plate Tin"

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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