From 6d2e9eaab3a21d3eb572873c8d4fae8f1679e359 Mon Sep 17 00:00:00 2001 From: Chathulanka Gamage Date: Sat, 25 Jan 2025 14:27:00 +0000 Subject: [PATCH 1/4] add analysable condition to eval keybind --- ui/analyse/src/keyboard.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/analyse/src/keyboard.ts b/ui/analyse/src/keyboard.ts index 79ac69eb1d032..110fe251637e3 100644 --- a/ui/analyse/src/keyboard.ts +++ b/ui/analyse/src/keyboard.ts @@ -72,7 +72,9 @@ export const bind = (ctrl: AnalyseCtrl) => { if (ctrl.keyboardHelp) pubsub.emit('analysis.closeAll'); ctrl.redraw(); }) - .bind('l', ctrl.toggleCeval) + .bind('l', () => { + if (ctrl.ceval.analysable) ctrl.toggleCeval(); + }) .bind('z', () => { ctrl.toggleComputer(); ctrl.redraw(); From 93f3bf929e4712819defdeffad6ede51793fa9ae Mon Sep 17 00:00:00 2001 From: Chathulanka Gamage Date: Sun, 26 Jan 2025 11:41:49 +0000 Subject: [PATCH 2/4] i18n key for `Engine cannot analyse this game` --- modules/coreI18n/src/main/key.scala | 1 + translation/source/site.xml | 1 + ui/@types/lichess/i18n.d.ts | 2 ++ ui/ceval/src/view/main.ts | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/coreI18n/src/main/key.scala b/modules/coreI18n/src/main/key.scala index 3773d57ab9250..6e70239e210ab 100644 --- a/modules/coreI18n/src/main/key.scala +++ b/modules/coreI18n/src/main/key.scala @@ -1450,6 +1450,7 @@ object I18nKey: val `showThreat`: I18nKey = "showThreat" val `inLocalBrowser`: I18nKey = "inLocalBrowser" val `toggleLocalEvaluation`: I18nKey = "toggleLocalEvaluation" + val `engineCannotAnalyse`: I18nKey = "engineCannotAnalyse" val `promoteVariation`: I18nKey = "promoteVariation" val `makeMainLine`: I18nKey = "makeMainLine" val `deleteFromHere`: I18nKey = "deleteFromHere" diff --git a/translation/source/site.xml b/translation/source/site.xml index b8d17e98bece2..c1e726d4c8f9d 100644 --- a/translation/source/site.xml +++ b/translation/source/site.xml @@ -67,6 +67,7 @@ Show threat in local browser Toggle local evaluation + Engine cannot analyse this game Promote variation Make mainline Delete from here diff --git a/ui/@types/lichess/i18n.d.ts b/ui/@types/lichess/i18n.d.ts index 75859de752689..0a05f0de612f1 100644 --- a/ui/@types/lichess/i18n.d.ts +++ b/ui/@types/lichess/i18n.d.ts @@ -3137,6 +3137,8 @@ interface I18n { endgame: string; /** Endgame positions */ endgamePositions: string; + /** Engine cannot analyse this game */ + engineCannotAnalyse: string; /** Error loading engine */ engineFailed: string; /** This email address is invalid */ diff --git a/ui/ceval/src/view/main.ts b/ui/ceval/src/view/main.ts index 91ca2ec3ec3e3..98ffd8322931a 100644 --- a/ui/ceval/src/view/main.ts +++ b/ui/ceval/src/view/main.ts @@ -233,7 +233,7 @@ export function renderCeval(ctrl: ParentCtrl): LooseVNodes { h('help', [ ...engineName(ceval), h('br'), - ceval.analysable ? i18n.site.inLocalBrowser : 'Engine cannot analyse this game', + ceval.analysable ? i18n.site.inLocalBrowser : i18n.site.engineCannotAnalyse, ]), ]; From ec185cef050ef92ddbeef22b9fbc56e1fa0f8f16 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Tue, 28 Jan 2025 10:28:08 +0100 Subject: [PATCH 3/4] fix wording of illegal position analysis it's about the position, not the game --- ui/ceval/src/view/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/ceval/src/view/main.ts b/ui/ceval/src/view/main.ts index 98ffd8322931a..a0b92591f36e1 100644 --- a/ui/ceval/src/view/main.ts +++ b/ui/ceval/src/view/main.ts @@ -233,7 +233,7 @@ export function renderCeval(ctrl: ParentCtrl): LooseVNodes { h('help', [ ...engineName(ceval), h('br'), - ceval.analysable ? i18n.site.inLocalBrowser : i18n.site.engineCannotAnalyse, + ceval.analysable ? i18n.site.inLocalBrowser : 'Illegal positions cannot be analyzed', ]), ]; From 5d4f169c6ef02913f4efbede714b0f419b0de403 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Tue, 28 Jan 2025 10:28:25 +0100 Subject: [PATCH 4/4] remove superfluous translation of rare error message --- modules/coreI18n/src/main/key.scala | 1 - translation/source/site.xml | 1 - ui/@types/lichess/i18n.d.ts | 2 -- 3 files changed, 4 deletions(-) diff --git a/modules/coreI18n/src/main/key.scala b/modules/coreI18n/src/main/key.scala index 6e70239e210ab..3773d57ab9250 100644 --- a/modules/coreI18n/src/main/key.scala +++ b/modules/coreI18n/src/main/key.scala @@ -1450,7 +1450,6 @@ object I18nKey: val `showThreat`: I18nKey = "showThreat" val `inLocalBrowser`: I18nKey = "inLocalBrowser" val `toggleLocalEvaluation`: I18nKey = "toggleLocalEvaluation" - val `engineCannotAnalyse`: I18nKey = "engineCannotAnalyse" val `promoteVariation`: I18nKey = "promoteVariation" val `makeMainLine`: I18nKey = "makeMainLine" val `deleteFromHere`: I18nKey = "deleteFromHere" diff --git a/translation/source/site.xml b/translation/source/site.xml index c1e726d4c8f9d..b8d17e98bece2 100644 --- a/translation/source/site.xml +++ b/translation/source/site.xml @@ -67,7 +67,6 @@ Show threat in local browser Toggle local evaluation - Engine cannot analyse this game Promote variation Make mainline Delete from here diff --git a/ui/@types/lichess/i18n.d.ts b/ui/@types/lichess/i18n.d.ts index 0a05f0de612f1..75859de752689 100644 --- a/ui/@types/lichess/i18n.d.ts +++ b/ui/@types/lichess/i18n.d.ts @@ -3137,8 +3137,6 @@ interface I18n { endgame: string; /** Endgame positions */ endgamePositions: string; - /** Engine cannot analyse this game */ - engineCannotAnalyse: string; /** Error loading engine */ engineFailed: string; /** This email address is invalid */