diff --git a/src/components/boards/Board.tsx b/src/components/boards/Board.tsx index 0b33c1b6..16c825e2 100644 --- a/src/components/boards/Board.tsx +++ b/src/components/boards/Board.tsx @@ -800,7 +800,7 @@ function Board({ {error && ( - {chessopsError(error)} + {t(chessopsError(error))} )} diff --git a/src/translation/en_US.ts b/src/translation/en_US.ts index bdb60012..db714884 100644 --- a/src/translation/en_US.ts +++ b/src/translation/en_US.ts @@ -252,6 +252,21 @@ export const en_US = { "Databases.Delete.Message": "Are you sure you want to delete this database?", + "Errors.EmptyBoard": "Empty board", + "Errors.InvalidKings": "Invalid number of kings", + "Errors.OppositeCheck": "Opposite check", + "Errors.PawnsOnBackrank": "Pawns on backrank", + "Errors.InvalidBoard": "Invalid board", + "Errors.InvalidCastlingRights": "Invalid castling rights", + "Errors.InvalidEpSquare": "Invalid en passant square", + "Errors.InvalidFen": "Invalid FEN", + "Errors.InvalidFullmoves": "Invalid fullmove number", + "Errors.InvalidHaldmoves": "Invalid halfmove number", + "Errors.InvalidPockets": "Invalid pockets", + "Errors.InvalidRemainingChecks": "Invalid remaining checks", + "Errors.InvalidTurn": "Invalid turn", + "Errors.Unknown": "Unknown error", + "Files.Title": "Files", "Files.FileType": "File type", "Files.FileType.Game": "Game", diff --git a/src/translation/fr_FR.ts b/src/translation/fr_FR.ts index 5181a110..d7d49e94 100644 --- a/src/translation/fr_FR.ts +++ b/src/translation/fr_FR.ts @@ -254,6 +254,21 @@ export const fr_FR = { "Databases.Delete.Message": "Êtes-vous sûr de vouloir supprimer cette base de données ?", + "Errors.EmptyBoard": "Échiquier vide", + "Errors.InvalidKings": "Nombre de Rois invalide", + "Errors.OppositeCheck": "Échec opposé", + "Errors.PawnsOnBackrank": "Pions en dernière rangée", + "Errors.InvalidBoard": "Échiquier invalide", + "Errors.InvalidCastlingRights": "Droits de roque invalide", + "Errors.InvalidEpSquare": "Case en passant invalide", + "Errors.InvalidFen": "FEN invalide", + "Errors.InvalidFullmoves": "Nombre de coup complet invalide", + "Errors.InvalidHalfmoves": "Nombre de demi-coup invalide", + "Errors.InvalidPockets": "Invalid pockets", + "Errors.InvalidRemainingChecks": "Échecs restant invalide", + "Errors.InvalidTurn": "Trait invalide", + "Errors.Unknown": "Erreur inconnue", + "Files.Title": "Fichiers", "Files.FileType": "Type de fichier", "Files.FileType.Game": "Partie", diff --git a/src/utils/chessops.ts b/src/utils/chessops.ts index bf0a156e..7dfd5824 100644 --- a/src/utils/chessops.ts +++ b/src/utils/chessops.ts @@ -61,23 +61,29 @@ export function squareToCoordinates( export function chessopsError(error: PositionError | FenError) { return match(error) - .with({ message: IllegalSetup.Empty }, () => "Empty board") - .with({ message: IllegalSetup.Kings }, () => "Invalid number of kings") - .with({ message: IllegalSetup.OppositeCheck }, () => "Opposite check") - .with({ message: IllegalSetup.PawnsOnBackrank }, () => "Pawns on backrank") - .with({ message: InvalidFen.Board }, () => "Invalid board") - .with({ message: InvalidFen.Castling }, () => "Invalid castling rights") - .with({ message: InvalidFen.EpSquare }, () => "Invalid en passant square") - .with({ message: InvalidFen.Fen }, () => "Invalid FEN") - .with({ message: InvalidFen.Fullmoves }, () => "Invalid fullmove number") - .with({ message: InvalidFen.Halfmoves }, () => "Invalid halfmove number") - .with({ message: InvalidFen.Pockets }, () => "Invalid pockets") + .with({ message: IllegalSetup.Empty }, () => "Errors.EmptyBoard") + .with({ message: IllegalSetup.Kings }, () => "Errors.InvalidKings") + .with({ message: IllegalSetup.OppositeCheck }, () => "Errors.OppositeCheck") + .with( + { message: IllegalSetup.PawnsOnBackrank }, + () => "Errors.PawnsOnBackrank", + ) + .with({ message: InvalidFen.Board }, () => "Errors.InvalidBoard") + .with( + { message: InvalidFen.Castling }, + () => "Errors.InvalidCastlingRights", + ) + .with({ message: InvalidFen.EpSquare }, () => "Errors.InvalidEpSquare") + .with({ message: InvalidFen.Fen }, () => "Errors.InvalidFen") + .with({ message: InvalidFen.Fullmoves }, () => "Errors.InvalidFullmoves") + .with({ message: InvalidFen.Halfmoves }, () => "Errors.InvalidHalfmoves") + .with({ message: InvalidFen.Pockets }, () => "Errors.InvalidPockets") .with( { message: InvalidFen.RemainingChecks }, - () => "Invalid remaining checks", + () => "Errors.InvalidRemainingChecks", ) - .with({ message: InvalidFen.Turn }, () => "Invalid turn") - .otherwise(() => "Unknown error"); + .with({ message: InvalidFen.Turn }, () => "Errors.InvalidTurn") + .otherwise(() => "Errors.Unknown"); } export function forceEnPassant(