Skip to content

Commit

Permalink
mark some server messages for translation
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Apr 6, 2024
1 parent a8d3169 commit 7cedfc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/GameServer/Commands.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import GameServer.Options
import GameServer.SaveData
import GameServer.Hints
import GameServer.Tactic.LetIntros
import GameServer.RpcHandlers -- only needed to collect the translations of "level completed" msgs
import I18n

open Lean Meta Elab Command
Expand Down
11 changes: 8 additions & 3 deletions server/GameServer/RpcHandlers.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import GameServer.EnvExtensions
import GameServer.InteractiveGoal
import Std.Data.Array.Init.Basic
import GameServer.Hints
import I18n

open Lean
open Server
Expand Down Expand Up @@ -171,15 +172,19 @@ def completionDiagnostics (goalCount : Nat) (prevGoalCount : Nat) (completed : B
if goalCount == 0 then
if completed then
out := out.push {
message := .text "level completed! 🎉"
-- TODO: marking these with `t!` has the implication that every game
-- needs to translate these messages again,
-- but cannot think of another option
-- that would not involve manually adding them somewhere in the translation files.
message := .text t!"level completed! 🎉"
range := {
start := pos
«end» := pos
}
severity? := Lsp.DiagnosticSeverity.information }
else if completedWithWarnings then
out := out.push {
message := .text "level completed with warnings… 🎭"
message := .text t!"level completed with warnings… 🎭"
range := {
start := pos
«end» := pos
Expand All @@ -192,7 +197,7 @@ def completionDiagnostics (goalCount : Nat) (prevGoalCount : Nat) (completed : B
-- so showing the message "intermediate goal solved" would be confusing.
if (¬ (filterUnsolvedGoal startDiags).any (·.severity? == some .error)) then
out := out.push {
message := .text "intermediate goal solved! 🎉"
message := .text t!"intermediate goal solved! 🎉"
range := {
start := pos
«end» := pos
Expand Down

0 comments on commit 7cedfc5

Please sign in to comment.