Jump to content

Recommended Posts

Posted

How can I let a book use a translation from I18n?

or How can get I18n translation from local when it's a server?

I use it for books.

And please excuse my poor English.

Posted

Translation should only be done on the client. If you translate on a server it will 1) only translate to English and 2) send the English text to the client. You can translate a string with TextComponentTranslation or I18n.format

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

An API for what

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

What do you mean

1 minute ago, Taskkill said:

A book which can translate from I18n...

? I18n is an API for internationalising messages.

 

58 minutes ago, diesieben07 said:

Vanilla books don't support this. You can do it yourself using TextComponentTranslation.

 

46 minutes ago, Cadiboo said:

I18n.format

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
Just now, Cadiboo said:

What do you mean

? I18n is an API for internationalising messages.

 

 

 

Ummm, I wanna a book that can auto get the content from I18n from the key given by ItemStack(or NBT).

Posted
51 minutes ago, Cadiboo said:

I18n.format

That method formats/translates a translation key. Example: item.dirt.name -> Dirt.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
2 minutes ago, Cadiboo said:

That method formats/translates a translation key. Example: item.dirt.name -> Dirt.

I know. You don't understand what I mean. Maybe It's because of my poor English.

The book, just when I open it, it'll read the I18n keys and automatically translate to the content.

Posted (edited)
1 hour ago, Taskkill said:

The book, just when I open it, it'll read the I18n keys and automatically translate to the content.

There is nothing you can do about translating vanilla books.

The content of vanilla books are stored in the NBT of the stack, and the book will not auto-localize its content when opened by a player.

You can, however, create your own custom item book that opens a custom GUI when right clicked in hand. This will allow you to add translations.

 

2 hours ago, Taskkill said:

or How can get I18n translation from local when it's a server?

Doing so doesn't make much sense, as the sole purpose of localizations is to allow client-specific translation.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)
4 minutes ago, fcelon said:

There is. Every text component in vanilla minecraft can be translated. You need to set the translate string in book page text nbt to translation key. https://minecraft.gamepedia.com/Commands#Raw_JSON_text

He meant translating book content on the client side.

the content of a vanilla book always stays the same can cannot be localized client-wise.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

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.