From 49e5dc665a327327bcd752d01a61030be8b10196 Mon Sep 17 00:00:00 2001 From: YaFred Date: Sun, 8 Dec 2024 20:50:03 +0100 Subject: [PATCH 1/3] translate puzzle boardmenu and game boardmenu --- modules/coreI18n/src/main/key.scala | 4 +++- translation/source/preferences.xml | 3 +++ ui/@types/lichess/i18n.d.ts | 6 ++++++ ui/common/src/boardMenu.ts | 8 ++++---- ui/puzzle/src/view/boardMenu.ts | 2 +- ui/round/src/view/boardMenu.ts | 4 ++-- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/modules/coreI18n/src/main/key.scala b/modules/coreI18n/src/main/key.scala index b3b98ba0f4830..06427f01f31ee 100644 --- a/modules/coreI18n/src/main/key.scala +++ b/modules/coreI18n/src/main/key.scala @@ -202,7 +202,6 @@ object I18nKey: val `timezone`: I18nKey = "broadcast:timezone" val `fideRatingCategory`: I18nKey = "broadcast:fideRatingCategory" val `optionalDetails`: I18nKey = "broadcast:optionalDetails" - val `upcomingBroadcasts`: I18nKey = "broadcast:upcomingBroadcasts" val `pastBroadcasts`: I18nKey = "broadcast:pastBroadcasts" val `allBroadcastsByMonth`: I18nKey = "broadcast:allBroadcastsByMonth" val `nbBroadcasts`: I18nKey = "broadcast:nbBroadcasts" @@ -1134,6 +1133,9 @@ object I18nKey: val `notifyWeb`: I18nKey = "preferences:notifyWeb" val `notifyDevice`: I18nKey = "preferences:notifyDevice" val `bellNotificationSound`: I18nKey = "preferences:bellNotificationSound" + val `blindFold`: I18nKey = "preferences:blindFold" + val `voiceInput`: I18nKey = "preferences:voiceInput" + val `keyboardInput`: I18nKey = "preferences:keyboardInput" object puzzle: val `puzzles`: I18nKey = "puzzle:puzzles" diff --git a/translation/source/preferences.xml b/translation/source/preferences.xml index 2ec3b7ddb337c..7e7ad48c9a835 100644 --- a/translation/source/preferences.xml +++ b/translation/source/preferences.xml @@ -67,4 +67,7 @@ Browser Device Bell notification sound + Blindfold + Voice input + Keyboard input diff --git a/ui/@types/lichess/i18n.d.ts b/ui/@types/lichess/i18n.d.ts index f5fa3584abd7f..988498059dca5 100644 --- a/ui/@types/lichess/i18n.d.ts +++ b/ui/@types/lichess/i18n.d.ts @@ -2065,6 +2065,8 @@ interface I18n { preferences: { /** Bell notification sound */ bellNotificationSound: string; + /** Blindfold */ + blindFold: string; /** Board coordinates (A-H, 1-8) */ boardCoordinates: string; /** Board highlights (last move and check) */ @@ -2121,6 +2123,8 @@ interface I18n { inputMovesWithTheKeyboard: string; /** Input moves with your voice */ inputMovesWithVoice: string; + /** Keyboard input */ + keyboardInput: string; /** Material difference */ materialDifference: string; /** Move confirmation */ @@ -2187,6 +2191,8 @@ interface I18n { takebacksWithOpponentApproval: string; /** Tenths of seconds */ tenthsOfSeconds: string; + /** Voice input */ + voiceInput: string; /** When premoving */ whenPremoving: string; /** When time remaining < 10 seconds */ diff --git a/ui/common/src/boardMenu.ts b/ui/common/src/boardMenu.ts index b96c4c9fde8ee..2037703045408 100644 --- a/ui/common/src/boardMenu.ts +++ b/ui/common/src/boardMenu.ts @@ -44,7 +44,7 @@ export class BoardMenu { zenMode = (enabled = true): VNode => this.cmnToggle({ - name: 'Zen mode', + name: i18n.preferences.zenMode, id: 'zen', checked: $('body').hasClass('zen'), change: () => pubsub.emit('zen'), @@ -53,7 +53,7 @@ export class BoardMenu { voiceInput = (toggle: Toggle, enabled = true): VNode => this.cmnToggle({ - name: 'Voice input', + name: i18n.preferences.voiceInput, id: 'voice', checked: toggle(), change: toggle, @@ -63,7 +63,7 @@ export class BoardMenu { keyboardInput = (toggle: Toggle, enabled = true): VNode => this.cmnToggle({ - name: 'Keyboard input', + name: i18n.preferences.keyboardInput, id: 'keyboard', checked: toggle(), change: toggle, @@ -73,7 +73,7 @@ export class BoardMenu { blindfold = (toggle: Toggle, enabled = true): VNode => this.cmnToggle({ - name: 'Blindfold', + name: i18n.preferences.blindFold, id: 'blindfold', checked: toggle(), change: toggle, diff --git a/ui/puzzle/src/view/boardMenu.ts b/ui/puzzle/src/view/boardMenu.ts index c85f207e7f271..6c6b46368f38f 100644 --- a/ui/puzzle/src/view/boardMenu.ts +++ b/ui/puzzle/src/view/boardMenu.ts @@ -20,7 +20,7 @@ export default function (ctrl: PuzzleCtrl) { h( 'a', { attrs: { target: '_blank', href: '/account/preferences/display' } }, - 'Game display preferences', + i18n.preferences.display, ), ]), ]); diff --git a/ui/round/src/view/boardMenu.ts b/ui/round/src/view/boardMenu.ts index 80e5428ecee3d..0e4775db6e893 100644 --- a/ui/round/src/view/boardMenu.ts +++ b/ui/round/src/view/boardMenu.ts @@ -27,12 +27,12 @@ export default function (ctrl: RoundController): LooseVNode { h( 'a', { attrs: { target: '_blank', href: '/account/preferences/display' } }, - 'Game display preferences', + i18n.preferences.display, ), h( 'a', { attrs: { target: '_blank', href: '/account/preferences/game-behavior ' } }, - 'Game behavior preferences', + i18n.preferences.gameBehavior, ), ]), ]; From c857af85b26513d653f670d11263ad1ebcd5550c Mon Sep 17 00:00:00 2001 From: YaFred Date: Sun, 8 Dec 2024 20:56:16 +0100 Subject: [PATCH 2/3] pnpm format --- ui/puzzle/src/view/boardMenu.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/puzzle/src/view/boardMenu.ts b/ui/puzzle/src/view/boardMenu.ts index 6c6b46368f38f..d1ed0a9ff32e1 100644 --- a/ui/puzzle/src/view/boardMenu.ts +++ b/ui/puzzle/src/view/boardMenu.ts @@ -17,11 +17,7 @@ export default function (ctrl: PuzzleCtrl) { menu.keyboardInput(boolPrefXhrToggle('keyboardMove', !!ctrl.keyboardMove), true), ]), h('section.board-menu__links', [ - h( - 'a', - { attrs: { target: '_blank', href: '/account/preferences/display' } }, - i18n.preferences.display, - ), + h('a', { attrs: { target: '_blank', href: '/account/preferences/display' } }, i18n.preferences.display), ]), ]); } From cb06f45db425d1de5313988b135bc01a83b5a380 Mon Sep 17 00:00:00 2001 From: YaFred Date: Mon, 9 Dec 2024 19:00:09 +0100 Subject: [PATCH 3/3] use existing translations --- modules/coreI18n/src/main/key.scala | 4 +--- translation/source/preferences.xml | 4 +--- ui/@types/lichess/i18n.d.ts | 6 +----- ui/common/src/boardMenu.ts | 6 +++--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/modules/coreI18n/src/main/key.scala b/modules/coreI18n/src/main/key.scala index 06427f01f31ee..e4179c5b93215 100644 --- a/modules/coreI18n/src/main/key.scala +++ b/modules/coreI18n/src/main/key.scala @@ -1133,9 +1133,7 @@ object I18nKey: val `notifyWeb`: I18nKey = "preferences:notifyWeb" val `notifyDevice`: I18nKey = "preferences:notifyDevice" val `bellNotificationSound`: I18nKey = "preferences:bellNotificationSound" - val `blindFold`: I18nKey = "preferences:blindFold" - val `voiceInput`: I18nKey = "preferences:voiceInput" - val `keyboardInput`: I18nKey = "preferences:keyboardInput" + val `blindfold`: I18nKey = "preferences:blindfold" object puzzle: val `puzzles`: I18nKey = "puzzle:puzzles" diff --git a/translation/source/preferences.xml b/translation/source/preferences.xml index 7e7ad48c9a835..2a0040d62e1be 100644 --- a/translation/source/preferences.xml +++ b/translation/source/preferences.xml @@ -67,7 +67,5 @@ Browser Device Bell notification sound - Blindfold - Voice input - Keyboard input + Blindfold diff --git a/ui/@types/lichess/i18n.d.ts b/ui/@types/lichess/i18n.d.ts index 988498059dca5..8df1de4f1f739 100644 --- a/ui/@types/lichess/i18n.d.ts +++ b/ui/@types/lichess/i18n.d.ts @@ -2066,7 +2066,7 @@ interface I18n { /** Bell notification sound */ bellNotificationSound: string; /** Blindfold */ - blindFold: string; + blindfold: string; /** Board coordinates (A-H, 1-8) */ boardCoordinates: string; /** Board highlights (last move and check) */ @@ -2123,8 +2123,6 @@ interface I18n { inputMovesWithTheKeyboard: string; /** Input moves with your voice */ inputMovesWithVoice: string; - /** Keyboard input */ - keyboardInput: string; /** Material difference */ materialDifference: string; /** Move confirmation */ @@ -2191,8 +2189,6 @@ interface I18n { takebacksWithOpponentApproval: string; /** Tenths of seconds */ tenthsOfSeconds: string; - /** Voice input */ - voiceInput: string; /** When premoving */ whenPremoving: string; /** When time remaining < 10 seconds */ diff --git a/ui/common/src/boardMenu.ts b/ui/common/src/boardMenu.ts index 2037703045408..9aa8c72967bcf 100644 --- a/ui/common/src/boardMenu.ts +++ b/ui/common/src/boardMenu.ts @@ -53,7 +53,7 @@ export class BoardMenu { voiceInput = (toggle: Toggle, enabled = true): VNode => this.cmnToggle({ - name: i18n.preferences.voiceInput, + name: i18n.preferences.inputMovesWithVoice, id: 'voice', checked: toggle(), change: toggle, @@ -63,7 +63,7 @@ export class BoardMenu { keyboardInput = (toggle: Toggle, enabled = true): VNode => this.cmnToggle({ - name: i18n.preferences.keyboardInput, + name: i18n.preferences.inputMovesWithTheKeyboard, id: 'keyboard', checked: toggle(), change: toggle, @@ -73,7 +73,7 @@ export class BoardMenu { blindfold = (toggle: Toggle, enabled = true): VNode => this.cmnToggle({ - name: i18n.preferences.blindFold, + name: i18n.preferences.blindfold, id: 'blindfold', checked: toggle(), change: toggle,