tweak and complete tablebase i18n

pull/9791/head
Niklas Fiekas 2021-09-12 19:09:30 +02:00
parent ae004ea86d
commit a87d477323
5 changed files with 26 additions and 13 deletions

View File

@ -155,7 +155,10 @@ object userAnalysisI18n {
trans.averageRatingX,
trans.masterDbExplanation,
trans.mateInXHalfMoves,
trans.nextCaptureOrPawnMoveInXHalfMoves,
trans.dtzWithRounding,
trans.winOr50MovesByPriorMistake,
trans.lossOr50MovesByPriorMistake,
trans.unknownDueToRounding,
trans.noGameFound,
trans.maybeIncludeMoreGamesFromThePreferencesMenu,
trans.winPreventedBy50MoveRule,

View File

@ -142,7 +142,7 @@ def lint_string(ctx, dest, source, allow_missing=0):
for placeholder in re.findall(r"%\d+\$s", dest):
ctx.error(f"mixing placeholder styles: {placeholder} and %s")
for pattern in ["O-O", "SAN", "FEN", "PGN", "K, Q, R, B, N"]:
for pattern in ["O-O", "SAN", "FEN", "PGN", "K, Q, R, B, N", "DTZ50''"]:
m_source = source if pattern.isupper() else source.lower()
m_dest = dest if pattern.isupper() else dest.lower()
if pattern in m_source and pattern not in m_dest:

View File

@ -88,6 +88,7 @@ val `averageRatingX` = new I18nKey("averageRatingX")
val `recentGames` = new I18nKey("recentGames")
val `topGames` = new I18nKey("topGames")
val `masterDbExplanation` = new I18nKey("masterDbExplanation")
val `dtzWithRounding` = new I18nKey("dtzWithRounding")
val `noGameFound` = new I18nKey("noGameFound")
val `maybeIncludeMoreGamesFromThePreferencesMenu` = new I18nKey("maybeIncludeMoreGamesFromThePreferencesMenu")
val `openingExplorer` = new I18nKey("openingExplorer")
@ -95,6 +96,9 @@ val `openingEndgameExplorer` = new I18nKey("openingEndgameExplorer")
val `xOpeningExplorer` = new I18nKey("xOpeningExplorer")
val `winPreventedBy50MoveRule` = new I18nKey("winPreventedBy50MoveRule")
val `lossSavedBy50MoveRule` = new I18nKey("lossSavedBy50MoveRule")
val `winOr50MovesByPriorMistake` = new I18nKey("winOr50MovesByPriorMistake")
val `lossOr50MovesByPriorMistake` = new I18nKey("lossOr50MovesByPriorMistake")
val `unknownDueToRounding` = new I18nKey("unknownDueToRounding")
val `allSet` = new I18nKey("allSet")
val `importPgn` = new I18nKey("importPgn")
val `delete` = new I18nKey("delete")
@ -768,7 +772,6 @@ val `resignTheGame` = new I18nKey("resignTheGame")
val `youCantStartNewGame` = new I18nKey("youCantStartNewGame")
val `opponentLeftCounter` = new I18nKey("opponentLeftCounter")
val `mateInXHalfMoves` = new I18nKey("mateInXHalfMoves")
val `nextCaptureOrPawnMoveInXHalfMoves` = new I18nKey("nextCaptureOrPawnMoveInXHalfMoves")
val `nbBlunders` = new I18nKey("nbBlunders")
val `nbMistakes` = new I18nKey("nbMistakes")
val `nbInaccuracies` = new I18nKey("nbInaccuracies")

View File

@ -92,10 +92,7 @@
<item quantity="one">Mate in %s half-move</item>
<item quantity="other">Mate in %s half-moves</item>
</plurals>
<plurals name="nextCaptureOrPawnMoveInXHalfMoves">
<item quantity="one">Next capture or pawn move in %s half-move (Distance To Zeroing of the 50 move counter)</item>
<item quantity="other">Next capture or pawn move in %s half-moves (Distance To Zeroing of the 50 move counter)</item>
</plurals>
<string name="dtzWithRounding">DTZ50'' with rounding, based on number of half moves until next capture or pawn move</string>
<string name="noGameFound">No game found</string>
<string name="maybeIncludeMoreGamesFromThePreferencesMenu">Maybe include more games from the preferences menu?</string>
<string name="openingExplorer">Opening explorer</string>
@ -103,6 +100,9 @@
<string name="xOpeningExplorer">%s opening explorer</string>
<string name="winPreventedBy50MoveRule">Win prevented by 50-move rule</string>
<string name="lossSavedBy50MoveRule">Loss prevented by 50-move rule</string>
<string name="winOr50MovesByPriorMistake">Win or 50 moves by prior mistake</string>
<string name="lossOr50MovesByPriorMistake">Loss or 50 moves by prior mistake</string>
<string name="unknownDueToRounding">Win/loss only guaranteed if recommended tablebase line has been followed since the last capture or pawn move, due to possible rounding.</string>
<string name="allSet">All set!</string>
<string name="importPgn">Import PGN</string>
<string name="delete">Delete</string>

View File

@ -232,10 +232,16 @@ function gameActions(ctrl: AnalyseCtrl, game: OpeningGame): VNode {
);
}
function showTablebase(ctrl: AnalyseCtrl, fen: Fen, title: string, moves: TablebaseMoveStats[]): VNode[] {
function showTablebase(
ctrl: AnalyseCtrl,
fen: Fen,
title: string,
tooltip: string | undefined,
moves: TablebaseMoveStats[]
): VNode[] {
if (!moves.length) return [];
return [
h('div.title', title),
h('div.title', tooltip ? { attrs: { title: tooltip } } : {}, title),
h('table.tablebase', [
h(
'tbody',
@ -286,7 +292,7 @@ function showDtz(ctrl: AnalyseCtrl, fen: Fen, move: TablebaseMoveStats): VNode |
'result.' + winnerOf(fen, move),
{
attrs: {
title: ctrl.trans.plural('nextCaptureOrPawnMoveInXHalfMoves', Math.abs(move.dtz)),
title: trans('dtzWithRounding') + ' (Distance To Zeroing)',
},
},
'DTZ ' + Math.abs(move.dtz)
@ -362,22 +368,23 @@ function show(ctrl: AnalyseCtrl): MaybeVNode {
]);
else lastShow = showEmpty(ctrl, data.opening);
} else if (data && isTablebase(data)) {
const row = (category: TablebaseCategory, title: string) =>
const row = (category: TablebaseCategory, title: string, tooltip?: string) =>
showTablebase(
ctrl,
data.fen,
title,
tooltip,
data.moves.filter(m => m.category == category)
);
if (data.moves.length)
lastShow = h('div.data', [
...row('loss', trans('winning')),
...row('unknown', trans('unknown')),
...row('maybe-loss', 'Winning or 50 moves by prior mistake'),
...row('maybe-loss', trans('winOr50MovesByPriorMistake'), trans('unknownDueToRounding')),
...row('blessed-loss', trans('winPreventedBy50MoveRule')),
...row('draw', trans('drawn')),
...row('cursed-win', trans('lossSavedBy50MoveRule')),
...row('maybe-win', 'Losing or 50 moves by prior mistake'),
...row('maybe-win', trans('winOr50MovesByPriorMistake'), trans('unknownDueToRounding')),
...row('win', trans('losing')),
]);
else if (data.checkmate) lastShow = showGameEnd(ctrl, trans('checkmate'));