mark some server messages for translation

pull/224/head
Jon Eugster 2 years ago
parent a8d3169ebb
commit 7cedfc5038

@ -4,6 +4,7 @@ import GameServer.Options
import GameServer.SaveData import GameServer.SaveData
import GameServer.Hints import GameServer.Hints
import GameServer.Tactic.LetIntros import GameServer.Tactic.LetIntros
import GameServer.RpcHandlers -- only needed to collect the translations of "level completed" msgs
import I18n import I18n
open Lean Meta Elab Command open Lean Meta Elab Command

@ -2,6 +2,7 @@ import GameServer.EnvExtensions
import GameServer.InteractiveGoal import GameServer.InteractiveGoal
import Std.Data.Array.Init.Basic import Std.Data.Array.Init.Basic
import GameServer.Hints import GameServer.Hints
import I18n
open Lean open Lean
open Server open Server
@ -171,7 +172,11 @@ def completionDiagnostics (goalCount : Nat) (prevGoalCount : Nat) (completed : B
if goalCount == 0 then if goalCount == 0 then
if completed then if completed then
out := out.push { 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 := { range := {
start := pos start := pos
«end» := pos «end» := pos
@ -179,7 +184,7 @@ def completionDiagnostics (goalCount : Nat) (prevGoalCount : Nat) (completed : B
severity? := Lsp.DiagnosticSeverity.information } severity? := Lsp.DiagnosticSeverity.information }
else if completedWithWarnings then else if completedWithWarnings then
out := out.push { out := out.push {
message := .text "level completed with warnings… 🎭" message := .text t!"level completed with warnings… 🎭"
range := { range := {
start := pos start := pos
«end» := pos «end» := pos
@ -192,7 +197,7 @@ def completionDiagnostics (goalCount : Nat) (prevGoalCount : Nat) (completed : B
-- so showing the message "intermediate goal solved" would be confusing. -- so showing the message "intermediate goal solved" would be confusing.
if (¬ (filterUnsolvedGoal startDiags).any (·.severity? == some .error)) then if (¬ (filterUnsolvedGoal startDiags).any (·.severity? == some .error)) then
out := out.push { out := out.push {
message := .text "intermediate goal solved! 🎉" message := .text t!"intermediate goal solved! 🎉"
range := { range := {
start := pos start := pos
«end» := pos «end» := pos

Loading…
Cancel
Save