Skip to content

Commit

Permalink
Merge pull request #16274 from schlawg/fix-puzzle-theme-keys
Browse files Browse the repository at this point in the history
use consistent name for healthyMix theme
  • Loading branch information
ornicar authored Oct 30, 2024
2 parents e1ff02c + 1090991 commit f0afdaa
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 61 deletions.
2 changes: 2 additions & 0 deletions modules/coreI18n/src/main/key.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,8 @@ object I18nKey:
val `zugzwangDescription`: I18nKey = "puzzleTheme:zugzwangDescription"
val `healthyMix`: I18nKey = "puzzleTheme:healthyMix"
val `healthyMixDescription`: I18nKey = "puzzleTheme:healthyMixDescription"
val `mix`: I18nKey = "puzzleTheme:mix"
val `mixDescription`: I18nKey = "puzzleTheme:mixDescription"
val `playerGames`: I18nKey = "puzzleTheme:playerGames"
val `playerGamesDescription`: I18nKey = "puzzleTheme:playerGamesDescription"
val `puzzleDownloadInformation`: I18nKey = "puzzleTheme:puzzleDownloadInformation"
Expand Down
125 changes: 64 additions & 61 deletions modules/puzzle/src/main/PuzzleTheme.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,80 @@ case class PuzzleTheme(key: PuzzleTheme.Key, name: I18nKey, description: I18nKey

object PuzzleTheme:

private def apply(name: I18nKey, desc: I18nKey): PuzzleTheme =
PuzzleTheme(Key(name.value.split(":", 2).lift(1).getOrElse(name.value)), name, desc)

opaque type Key = String
object Key extends OpaqueString[Key]

case class WithCount(theme: PuzzleTheme, count: Int)

val mix = PuzzleTheme(Key("mix"), i.healthyMix, i.healthyMixDescription)
val advancedPawn = PuzzleTheme(Key("advancedPawn"), i.advancedPawn, i.advancedPawnDescription)
val advantage = PuzzleTheme(Key("advantage"), i.advantage, i.advantageDescription)
val anastasiaMate = PuzzleTheme(Key("anastasiaMate"), i.anastasiaMate, i.anastasiaMateDescription)
val arabianMate = PuzzleTheme(Key("arabianMate"), i.arabianMate, i.arabianMateDescription)
val attackingF2F7 = PuzzleTheme(Key("attackingF2F7"), i.attackingF2F7, i.attackingF2F7Description)
val attraction = PuzzleTheme(Key("attraction"), i.attraction, i.attractionDescription)
val backRankMate = PuzzleTheme(Key("backRankMate"), i.backRankMate, i.backRankMateDescription)
val bishopEndgame = PuzzleTheme(Key("bishopEndgame"), i.bishopEndgame, i.bishopEndgameDescription)
val bodenMate = PuzzleTheme(Key("bodenMate"), i.bodenMate, i.bodenMateDescription)
val mix = PuzzleTheme(i.mix, i.mixDescription)
val advancedPawn = PuzzleTheme(i.advancedPawn, i.advancedPawnDescription)
val advantage = PuzzleTheme(i.advantage, i.advantageDescription)
val anastasiaMate = PuzzleTheme(i.anastasiaMate, i.anastasiaMateDescription)
val arabianMate = PuzzleTheme(i.arabianMate, i.arabianMateDescription)
val attackingF2F7 = PuzzleTheme(i.attackingF2F7, i.attackingF2F7Description)
val attraction = PuzzleTheme(i.attraction, i.attractionDescription)
val backRankMate = PuzzleTheme(i.backRankMate, i.backRankMateDescription)
val bishopEndgame = PuzzleTheme(i.bishopEndgame, i.bishopEndgameDescription)
val bodenMate = PuzzleTheme(i.bodenMate, i.bodenMateDescription)
val capturingDefender =
PuzzleTheme(Key("capturingDefender"), i.capturingDefender, i.capturingDefenderDescription)
val castling = PuzzleTheme(Key("castling"), i.castling, i.castlingDescription)
val clearance = PuzzleTheme(Key("clearance"), i.clearance, i.clearanceDescription)
val crushing = PuzzleTheme(Key("crushing"), i.crushing, i.crushingDescription)
val defensiveMove = PuzzleTheme(Key("defensiveMove"), i.defensiveMove, i.defensiveMoveDescription)
val deflection = PuzzleTheme(Key("deflection"), i.deflection, i.deflectionDescription)
PuzzleTheme(i.capturingDefender, i.capturingDefenderDescription)
val castling = PuzzleTheme(i.castling, i.castlingDescription)
val clearance = PuzzleTheme(i.clearance, i.clearanceDescription)
val crushing = PuzzleTheme(i.crushing, i.crushingDescription)
val defensiveMove = PuzzleTheme(i.defensiveMove, i.defensiveMoveDescription)
val deflection = PuzzleTheme(i.deflection, i.deflectionDescription)
val discoveredAttack =
PuzzleTheme(Key("discoveredAttack"), i.discoveredAttack, i.discoveredAttackDescription)
PuzzleTheme(i.discoveredAttack, i.discoveredAttackDescription)
val doubleBishopMate =
PuzzleTheme(Key("doubleBishopMate"), i.doubleBishopMate, i.doubleBishopMateDescription)
val doubleCheck = PuzzleTheme(Key("doubleCheck"), i.doubleCheck, i.doubleCheckDescription)
PuzzleTheme(i.doubleBishopMate, i.doubleBishopMateDescription)
val doubleCheck = PuzzleTheme(i.doubleCheck, i.doubleCheckDescription)
val dovetailMate =
PuzzleTheme(Key("dovetailMate"), i.dovetailMate, i.dovetailMateDescription)
val equality = PuzzleTheme(Key("equality"), i.equality, i.equalityDescription)
val endgame = PuzzleTheme(Key("endgame"), i.endgame, i.endgameDescription)
val enPassant = PuzzleTheme(Key("enPassant"), I18nKey.learn.enPassant, i.enPassantDescription)
val exposedKing = PuzzleTheme(Key("exposedKing"), i.exposedKing, i.exposedKingDescription)
val fork = PuzzleTheme(Key("fork"), i.fork, i.forkDescription)
val hangingPiece = PuzzleTheme(Key("hangingPiece"), i.hangingPiece, i.hangingPieceDescription)
val hookMate = PuzzleTheme(Key("hookMate"), i.hookMate, i.hookMateDescription)
val interference = PuzzleTheme(Key("interference"), i.interference, i.interferenceDescription)
val intermezzo = PuzzleTheme(Key("intermezzo"), i.intermezzo, i.intermezzoDescription)
val kingsideAttack = PuzzleTheme(Key("kingsideAttack"), i.kingsideAttack, i.kingsideAttackDescription)
val knightEndgame = PuzzleTheme(Key("knightEndgame"), i.knightEndgame, i.knightEndgameDescription)
val long = PuzzleTheme(Key("long"), i.long, i.longDescription)
val master = PuzzleTheme(Key("master"), i.master, i.masterDescription)
val masterVsMaster = PuzzleTheme(Key("masterVsMaster"), i.masterVsMaster, i.masterVsMasterDescription)
val mate = PuzzleTheme(Key("mate"), i.mate, i.mateDescription)
val mateIn1 = PuzzleTheme(Key("mateIn1"), i.mateIn1, i.mateIn1Description)
val mateIn2 = PuzzleTheme(Key("mateIn2"), i.mateIn2, i.mateIn2Description)
val mateIn3 = PuzzleTheme(Key("mateIn3"), i.mateIn3, i.mateIn3Description)
val mateIn4 = PuzzleTheme(Key("mateIn4"), i.mateIn4, i.mateIn4Description)
val mateIn5 = PuzzleTheme(Key("mateIn5"), i.mateIn5, i.mateIn5Description)
val smotheredMate = PuzzleTheme(Key("smotheredMate"), i.smotheredMate, i.smotheredMateDescription)
val middlegame = PuzzleTheme(Key("middlegame"), i.middlegame, i.middlegameDescription)
val oneMove = PuzzleTheme(Key("oneMove"), i.oneMove, i.oneMoveDescription)
val opening = PuzzleTheme(Key("opening"), i.opening, i.openingDescription)
val pawnEndgame = PuzzleTheme(Key("pawnEndgame"), i.pawnEndgame, i.pawnEndgameDescription)
val pin = PuzzleTheme(Key("pin"), i.pin, i.pinDescription)
val promotion = PuzzleTheme(Key("promotion"), i.promotion, i.promotionDescription)
val queenEndgame = PuzzleTheme(Key("queenEndgame"), i.queenEndgame, i.queenEndgameDescription)
PuzzleTheme(i.dovetailMate, i.dovetailMateDescription)
val equality = PuzzleTheme(i.equality, i.equalityDescription)
val endgame = PuzzleTheme(i.endgame, i.endgameDescription)
val enPassant = PuzzleTheme(I18nKey.learn.enPassant, i.enPassantDescription)
val exposedKing = PuzzleTheme(i.exposedKing, i.exposedKingDescription)
val fork = PuzzleTheme(i.fork, i.forkDescription)
val hangingPiece = PuzzleTheme(i.hangingPiece, i.hangingPieceDescription)
val hookMate = PuzzleTheme(i.hookMate, i.hookMateDescription)
val interference = PuzzleTheme(i.interference, i.interferenceDescription)
val intermezzo = PuzzleTheme(i.intermezzo, i.intermezzoDescription)
val kingsideAttack = PuzzleTheme(i.kingsideAttack, i.kingsideAttackDescription)
val knightEndgame = PuzzleTheme(i.knightEndgame, i.knightEndgameDescription)
val long = PuzzleTheme(i.long, i.longDescription)
val master = PuzzleTheme(i.master, i.masterDescription)
val masterVsMaster = PuzzleTheme(i.masterVsMaster, i.masterVsMasterDescription)
val mate = PuzzleTheme(i.mate, i.mateDescription)
val mateIn1 = PuzzleTheme(i.mateIn1, i.mateIn1Description)
val mateIn2 = PuzzleTheme(i.mateIn2, i.mateIn2Description)
val mateIn3 = PuzzleTheme(i.mateIn3, i.mateIn3Description)
val mateIn4 = PuzzleTheme(i.mateIn4, i.mateIn4Description)
val mateIn5 = PuzzleTheme(i.mateIn5, i.mateIn5Description)
val smotheredMate = PuzzleTheme(i.smotheredMate, i.smotheredMateDescription)
val middlegame = PuzzleTheme(i.middlegame, i.middlegameDescription)
val oneMove = PuzzleTheme(i.oneMove, i.oneMoveDescription)
val opening = PuzzleTheme(i.opening, i.openingDescription)
val pawnEndgame = PuzzleTheme(i.pawnEndgame, i.pawnEndgameDescription)
val pin = PuzzleTheme(i.pin, i.pinDescription)
val promotion = PuzzleTheme(i.promotion, i.promotionDescription)
val queenEndgame = PuzzleTheme(i.queenEndgame, i.queenEndgameDescription)
val queenRookEndgame =
PuzzleTheme(Key("queenRookEndgame"), i.queenRookEndgame, i.queenRookEndgameDescription)
val queensideAttack = PuzzleTheme(Key("queensideAttack"), i.queensideAttack, i.queensideAttackDescription)
val quietMove = PuzzleTheme(Key("quietMove"), i.quietMove, i.quietMoveDescription)
val rookEndgame = PuzzleTheme(Key("rookEndgame"), i.rookEndgame, i.rookEndgameDescription)
val sacrifice = PuzzleTheme(Key("sacrifice"), i.sacrifice, i.sacrificeDescription)
val short = PuzzleTheme(Key("short"), i.short, i.shortDescription)
val skewer = PuzzleTheme(Key("skewer"), i.skewer, i.skewerDescription)
val superGM = PuzzleTheme(Key("superGM"), i.superGM, i.superGMDescription)
val trappedPiece = PuzzleTheme(Key("trappedPiece"), i.trappedPiece, i.trappedPieceDescription)
val underPromotion = PuzzleTheme(Key("underPromotion"), i.underPromotion, i.underPromotionDescription)
val veryLong = PuzzleTheme(Key("veryLong"), i.veryLong, i.veryLongDescription)
val xRayAttack = PuzzleTheme(Key("xRayAttack"), i.xRayAttack, i.xRayAttackDescription)
val zugzwang = PuzzleTheme(Key("zugzwang"), i.zugzwang, i.zugzwangDescription)
PuzzleTheme(i.queenRookEndgame, i.queenRookEndgameDescription)
val queensideAttack = PuzzleTheme(i.queensideAttack, i.queensideAttackDescription)
val quietMove = PuzzleTheme(i.quietMove, i.quietMoveDescription)
val rookEndgame = PuzzleTheme(i.rookEndgame, i.rookEndgameDescription)
val sacrifice = PuzzleTheme(i.sacrifice, i.sacrificeDescription)
val short = PuzzleTheme(i.short, i.shortDescription)
val skewer = PuzzleTheme(i.skewer, i.skewerDescription)
val superGM = PuzzleTheme(i.superGM, i.superGMDescription)
val trappedPiece = PuzzleTheme(i.trappedPiece, i.trappedPieceDescription)
val underPromotion = PuzzleTheme(i.underPromotion, i.underPromotionDescription)
val veryLong = PuzzleTheme(i.veryLong, i.veryLongDescription)
val xRayAttack = PuzzleTheme(i.xRayAttack, i.xRayAttackDescription)
val zugzwang = PuzzleTheme(i.zugzwang, i.zugzwangDescription)
val checkFirst = PuzzleTheme(Key("checkFirst"), I18nKey("Check first"), I18nKey("Check first"))

val categorized = List[(I18nKey, List[PuzzleTheme])](
Expand Down
2 changes: 2 additions & 0 deletions translation/source/puzzleTheme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
<string name="zugzwangDescription">The opponent is limited in the moves they can make, and all moves worsen their position.</string>
<string name="healthyMix">Healthy mix</string>
<string name="healthyMixDescription">A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games.</string>
<string name="mix">Healthy mix</string>
<string name="mixDescription">A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games.</string>
<string name="playerGames">Player games</string>
<string name="playerGamesDescription">Lookup puzzles generated from your games, or from another player's games.</string>
<string name="puzzleDownloadInformation">These puzzles are in the public domain, and can be downloaded from %s.</string>
Expand Down
4 changes: 4 additions & 0 deletions ui/@types/lichess/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,10 @@ interface I18n {
middlegame: string;
/** A tactic during the second phase of the game. */
middlegameDescription: string;
/** Healthy mix */
mix: string;
/** A bit of everything. You don't know what to expect, so you remain ready for anything! Just like in real games. */
mixDescription: string;
/** One-move puzzle */
oneMove: string;
/** A puzzle that is only one move long. */
Expand Down

0 comments on commit f0afdaa

Please sign in to comment.