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

Add chat translations #28

Merged
merged 1 commit into from
Jul 26, 2022
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
7 changes: 0 additions & 7 deletions spec/integration_spec.cr

This file was deleted.

9 changes: 9 additions & 0 deletions spec/models/chat_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ Spectator.describe Rosegold::Chat do
JSON
expect(chat.color).to eq("gold")
expect(chat.text).to eq("Connecting to the server...")
expect(chat.to_s).to eq("Connecting to the server...")
end

it "should translate" do
chat = Rosegold::Chat.from_json <<-JSON
{"translate":"chat.type.text","with":[{"insertion":"rosegold","clickEvent":{"action":"suggest_command","value":"/tell rosegold "},"hoverEvent":{"action":"show_entity","contents":{"type":"minecraft:player","id":"228ba5dc-a03c-3df0-8c5c-3385230406f0","name":{"text":"rosegold"}}},"text":"rosegold"},"Test chat message... Hello, Rosegold!"]}
JSON
expect(chat.translate).to eq("chat.type.text")
expect(chat.to_s).to eq("<rosegold> Test chat message... Hello, Rosegold!")
end
end
Loading