Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include empty components in translatable arguments #252

Merged
merged 1 commit into from
Dec 26, 2020

Conversation

Electroid
Copy link
Member

Consider the following scenario:

MessageFormat format = new MessageFormat("{1} was killed by {2}"); // key = player.death

Component message = translatable()
  .key("player.death")
  .args(empty(), text("Bob"), text("Alice"))
  .build()

If you translate message today, you'll get "Alice was killed by {2}". This is because AbstractComponent#asComponents filters out Component#empty. While this works in most situations, it causes index-skew with TranslatableComponent.

@Electroid
Copy link
Member Author

Also worth noting, this is a regression from 3.x

@zml2008 zml2008 added this to the 4.4.0 milestone Dec 25, 2020
@kashike kashike self-assigned this Dec 26, 2020
@kashike kashike merged commit b597d1b into master Dec 26, 2020
@kashike kashike deleted the fix/translatable-args branch December 26, 2020 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants