Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • About I18n
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
Taskkill

About I18n

By Taskkill, March 25 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Taskkill    1

Taskkill

Taskkill    1

  • Tree Puncher
  • Taskkill
  • Members
  • 1
  • 43 posts
Posted March 25

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.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45601 posts
Posted March 25

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

  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    275

Cadiboo

Cadiboo    275

  • Reality Controller
  • Cadiboo
  • Members
  • 275
  • 3303 posts
Posted March 25

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

  • Quote

Share this post


Link to post
Share on other sites

Taskkill    1

Taskkill

Taskkill    1

  • Tree Puncher
  • Taskkill
  • Members
  • 1
  • 43 posts
Posted March 25

Is there an API for it, or example? 

  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    275

Cadiboo

Cadiboo    275

  • Reality Controller
  • Cadiboo
  • Members
  • 275
  • 3303 posts
Posted March 25

An API for what

  • Quote

Share this post


Link to post
Share on other sites

Taskkill    1

Taskkill

Taskkill    1

  • Tree Puncher
  • Taskkill
  • Members
  • 1
  • 43 posts
Posted March 25
1 minute ago, Cadiboo said:

An API for what

A book which can translate from I18n...

  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    275

Cadiboo

Cadiboo    275

  • Reality Controller
  • Cadiboo
  • Members
  • 275
  • 3303 posts
Posted March 25

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

 

  • Quote

Share this post


Link to post
Share on other sites

Taskkill    1

Taskkill

Taskkill    1

  • Tree Puncher
  • Taskkill
  • Members
  • 1
  • 43 posts
Posted March 25
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).

  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    275

Cadiboo

Cadiboo    275

  • Reality Controller
  • Cadiboo
  • Members
  • 275
  • 3303 posts
Posted March 25
51 minutes ago, Cadiboo said:

I18n.format

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

  • Quote

Share this post


Link to post
Share on other sites

Taskkill    1

Taskkill

Taskkill    1

  • Tree Puncher
  • Taskkill
  • Members
  • 1
  • 43 posts
Posted March 25
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.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45601 posts
Posted March 25

Such a thing does not exist. You need to make it yourself.

  • Quote

Share this post


Link to post
Share on other sites

Taskkill    1

Taskkill

Taskkill    1

  • Tree Puncher
  • Taskkill
  • Members
  • 1
  • 43 posts
Posted March 25
1 minute ago, diesieben07 said:

Such a thing does not exist. You need to make it yourself.

Okay...

  • Quote

Share this post


Link to post
Share on other sites

DavidM    101

DavidM

DavidM    101

  • World Shaper
  • DavidM
  • Members
  • 101
  • 1123 posts
Posted March 25 (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 March 25 by DavidM
  • Quote

Share this post


Link to post
Share on other sites

fcelon    2

fcelon

fcelon    2

  • Creeper Killer
  • fcelon
  • Members
  • 2
  • 105 posts
Posted March 25
8 hours ago, DavidM said:

There is nothing you can do about translating vanilla books.

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

  • Quote

Share this post


Link to post
Share on other sites

DavidM    101

DavidM

DavidM    101

  • World Shaper
  • DavidM
  • Members
  • 101
  • 1123 posts
Posted March 25 (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 March 25 by DavidM
  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Rohman
      [1.12.2 Build 2847] Server Crash on startup

      By Rohman · Posted 31 minutes ago

      Here you go. Thanks for having a look. debug(1).log
    • diesieben07
      Server Cannot Start

      By diesieben07 · Posted 52 minutes ago

      You installed a client-only mod (Controllable) on the server. Mods have the ability to indicate their client-only-ness to Forge and it will not load the mod on a server. This mod has not done so, please report this bug to the mod author.
    • diesieben07
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By diesieben07 · Posted 58 minutes ago

      Why would you replace them?! This is a simple method override and you are calling super. There is no need to replace anything. Again: Please learn Java basics before making a mod.
    • diesieben07
      [1.12.2 Build 2847] Server Crash on startup

      By diesieben07 · Posted 1 hour ago

      Post the debug.log file.
    • diesieben07
      Need your help pls

      By diesieben07 · Posted 1 hour ago

      1.8.9 is no longer supported on this forum due to it's age. Update to a modern version of Minecraft to receive support.
  • Topics

    • Rohman
      2
      [1.12.2 Build 2847] Server Crash on startup

      By Rohman
      Started 1 hour ago

    • The_Unkown675
      1
      Server Cannot Start

      By The_Unkown675
      Started 4 hours ago

    • J0WAY
      17
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY
      Started Thursday at 09:10 PM

    • _jiriik_
      1
      Need your help pls

      By _jiriik_
      Started 3 hours ago

    • Kuaka
      0
      My Forge 1.12 and 1.12.2 Keep Crashing when i start it up

      By Kuaka
      Started 1 hour ago

  • Who's Online (See full list)

    • Ugdhar
    • Gnaux
    • plugsmustard
    • vaartis
    • HussNuss
    • AkosM
    • Ollie_Bear
    • Kuaka
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • About I18n
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community