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

Fix translate field name confusion #608

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcstatus/motd/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _check_rgb(rgb: tuple[int, int, int]) -> None:
class TranslationTag:
"""Represents a ``translate`` field in server's answer.

This just exist, but is completely ignored by our transformers.
This just exists, but is completely ignored by our transformers.
You can find translation tags in :attr:`Motd.parsed <mcstatus.motd.Motd.parsed>` attribute.

.. seealso:: `Minecraft's wiki. <https://minecraft.fandom.com/wiki/Raw_JSON_text_format#Translated_Text>`__
Expand Down
4 changes: 2 additions & 2 deletions mcstatus/status_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class RawJavaResponseVersion(TypedDict):
protocol: int

class RawJavaResponseMotdWhenDict(TypedDict, total=False):
text: str # only present if translation is set
translation: str # same to the above field
text: str # only present if `translate` is set
translate: str # same to the above field
extra: list[RawJavaResponseMotdWhenDict]

color: str
Expand Down
4 changes: 2 additions & 2 deletions tests/motd/test_motd.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def test_formatting_key_set_to_false_here_without_it_being_set_to_true_before(se
Formatting.RESET,
]

def test_translation_string(self):
assert Motd.parse(RawJavaResponseMotdWhenDict(translation="the key")).parsed == [
def test_translate_string(self):
assert Motd.parse(RawJavaResponseMotdWhenDict(translate="the key")).parsed == [
TranslationTag("the key"),
Formatting.RESET,
]
Expand Down
Loading