Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: ChampionAsh5357 <[email protected]>
  • Loading branch information
tmvkrpxl0 and ChampionAsh5357 authored Jul 30, 2023
1 parent ab4b906 commit b9da264
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/concepts/internationalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Read [components] for more details.

### `TextComponentHelper`

- `createComponentTranslation(CommandSource, String, Object...)` is useful for messaging between clients and server, where vanilla clients can also join. If the receiver is vanilla client, the method will eagerly localize and format the provided translation key in sender's locale, or American English if no locale is loaded, as modded server may allow vanilla clients to join, and they will lack localization data required to do it itself. Otherwise, the method will create component with `TranslatableContents`.
- `createComponentTranslation(CommandSource, String, Object...)` is useful for sending messages between clients and the server. If the receiver is a vanilla client, the method will eagerly localize and format the provided translation key in sender's locale, or American English if no locale is loaded; the modded server may allow vanilla clients to join, and they will lack localization data required to localize the message itself. Otherwise, the method will create the component with `TranslatableContents`.

[langs]: https://minecraft.fandom.com/wiki/Language#Languages
[converter]: https://tterrag.com/lang2json/
Expand Down
8 changes: 4 additions & 4 deletions docs/misc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Text Components

`Component` is a holder for text which can be formatted and chained with other components.
The subtype `MutableComponent` is used to apply formats and chain other components.
A Component can be created using one of the available static helpers:
A component can be created using one of the available static helpers:

| Method Name | Description |
|----------------|-----------------------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -68,10 +68,10 @@ Chaining Components

`MutableComponent` can have additional components chained as siblings with `MutableComponent#append`. Chained components can be retrieved with `MutableComponent#getSiblings`.

`Component` stores its siblings like a tree, and its style is merged with those of siblings as shown in the [image][tree].
`Component` stores its siblings like a tree and traversed in preorder; the parent style is merged with those of its siblings.
The tree is traversed in preorder.

Below example will create a component with the same structure as the above image:
The code below will create a component with the same structure in the above example:
```java
// Create text only components
MutableComponent first = Component.literal("first ");
Expand Down Expand Up @@ -106,7 +106,7 @@ Text formatting is the process of inserting data as text into predefined larger
It can be used for displaying coordinate with x, y, z annotation, showing number with respectful units alongside, etc.
Usually special notation called **format specifiers** are used for indicating where a text can be inserted into.

`TranslatableContents` uses two types of format specifiers: `%s` and `%1$s`, `%2$s`, `%3$s`.
`TranslatableContents` uses two types of format specifiers: `%s` and `%n$s`.
Its `args` are inserted in place of format specifiers.
This feature is useful as order of information in various languages varies.

Expand Down

1 comment on commit b9da264

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: b9da26440b3b601b519dd4fe312e1dd87dc9a992
Status: ✅ Deploy successful!
Preview URL: https://adf3b6c4.neoforged-docs-previews.pages.dev
PR Preview URL: https://pr-4.neoforged-docs-previews.pages.dev

Please sign in to comment.