mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
i18n today section
This commit is contained in:
parent
41d77b0255
commit
01f3a71f0a
4 changed files with 99 additions and 95 deletions
|
@ -5,7 +5,6 @@ statistics-due-count = Due
|
|||
# Shown in the Due column of the Browse screen when the card is a new card
|
||||
statistics-due-for-new-card = New #{ $number }
|
||||
|
||||
|
||||
## eg 16.8s (3.6 cards/minute)
|
||||
|
||||
statistics-cards-per-min = { $cards-per-minute } cards/minute
|
||||
|
@ -14,49 +13,47 @@ statistics-average-answer-time = {$average-seconds}s ({ statistics-cards-per-min
|
|||
## A span of time studying took place in, for example
|
||||
## "(studied 30 cards) in 3 minutes"
|
||||
|
||||
statistics-in-time-span-seconds = { $amount ->
|
||||
statistics-in-time-span-seconds =
|
||||
{ $amount ->
|
||||
[one] in { $amount } second
|
||||
*[other] in { $amount } seconds
|
||||
}
|
||||
|
||||
statistics-in-time-span-minutes = { $amount ->
|
||||
statistics-in-time-span-minutes =
|
||||
{ $amount ->
|
||||
[one] in { $amount } minute
|
||||
*[other] in { $amount } minutes
|
||||
}
|
||||
|
||||
statistics-in-time-span-hours = { $amount ->
|
||||
statistics-in-time-span-hours =
|
||||
{ $amount ->
|
||||
[one] in { $amount } hour
|
||||
*[other] in { $amount } hours
|
||||
}
|
||||
|
||||
statistics-in-time-span-days = { $amount ->
|
||||
statistics-in-time-span-days =
|
||||
{ $amount ->
|
||||
[one] in { $amount } day
|
||||
*[other] in { $amount } days
|
||||
}
|
||||
|
||||
statistics-in-time-span-months = { $amount ->
|
||||
statistics-in-time-span-months =
|
||||
{ $amount ->
|
||||
[one] in { $amount } month
|
||||
*[other] in { $amount } months
|
||||
}
|
||||
|
||||
statistics-in-time-span-years = { $amount ->
|
||||
statistics-in-time-span-years =
|
||||
{ $amount ->
|
||||
[one] in { $amount } year
|
||||
*[other] in { $amount } years
|
||||
}
|
||||
|
||||
##
|
||||
|
||||
statistics-cards = { $cards ->
|
||||
statistics-cards =
|
||||
{ $cards ->
|
||||
[one] { $cards } card
|
||||
*[other] { $cards } cards
|
||||
}
|
||||
|
||||
# a count of how many cards have been answered, eg "Total: 34 reviews"
|
||||
statistics-reviews = { $reviews ->
|
||||
statistics-reviews =
|
||||
{ $reviews ->
|
||||
[one] 1 review
|
||||
*[other] { $reviews } reviews
|
||||
}
|
||||
|
||||
# Shown at the bottom of the deck list, and in the statistics screen.
|
||||
# eg "Studied 3 cards in 13 seconds today (4.33s/card)."
|
||||
# The { statistics-in-time-span-seconds } part should be pasted in from the English
|
||||
|
@ -72,6 +69,11 @@ statistics-studied-today =
|
|||
*[years] { statistics-in-time-span-years }
|
||||
} today
|
||||
({ $secs-per-card }s/card)
|
||||
|
||||
# eg, "Time taken to review card: 5s"
|
||||
statistics-seconds-taken = { $seconds }s
|
||||
statistics-today-title = Today
|
||||
statistics-today-again-count = Again count:
|
||||
statistics-today-type-counts = Learn: { $learnCount }, Review: { $reviewCount }, Relearn: { $relearnCount }, Filtered: { $filteredCount }
|
||||
statistics-today-no-cards = No cards have been studied today.
|
||||
statistics-today-no-mature-cards = No mature cards were studied today.
|
||||
statistics-today-correct-mature = Correct answers on mature cards: { $correct }/{ $total } ({ $percent }%)
|
||||
|
|
|
@ -9,16 +9,18 @@
|
|||
|
||||
let todayData: TodayData | null = null;
|
||||
$: if (sourceData) {
|
||||
console.log("gathering data");
|
||||
todayData = gatherData(sourceData, i18n);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if todayData}
|
||||
<div class="graph">
|
||||
<h1>Today</h1>
|
||||
<h1>{todayData.title}</h1>
|
||||
|
||||
<div>{todayData.studiedToday}</div>
|
||||
{JSON.stringify(todayData)}
|
||||
<div class="legend-outer">
|
||||
{#each todayData.lines as line}
|
||||
<div>{line}</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
@ -115,21 +115,6 @@
|
|||
transition: opacity 1s;
|
||||
}
|
||||
|
||||
.tooltip-area {
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
.tooltip-area > * {
|
||||
flex: 1 100%;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.legend-outer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.legend-outer div {
|
||||
padding-left: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -6,15 +6,8 @@ import { studiedToday } from "../time";
|
|||
import { I18n } from "../i18n";
|
||||
|
||||
export interface TodayData {
|
||||
correctCount: number;
|
||||
matureCorrect: number;
|
||||
matureCount: number;
|
||||
learnCount: number;
|
||||
reviewCount: number;
|
||||
relearnCount: number;
|
||||
earlyReviewCount: number;
|
||||
|
||||
studiedToday: string;
|
||||
title: string;
|
||||
lines: string[];
|
||||
}
|
||||
|
||||
const ReviewKind = pb.BackendProto.RevlogEntry.ReviewKind;
|
||||
|
@ -71,16 +64,38 @@ export function gatherData(data: pb.BackendProto.GraphsOut, i18n: I18n): TodayDa
|
|||
}
|
||||
}
|
||||
|
||||
let lines: string[];
|
||||
if (answerCount) {
|
||||
const studiedTodayText = studiedToday(i18n, answerCount, answerMillis / 1000);
|
||||
|
||||
return {
|
||||
studiedToday: studiedTodayText,
|
||||
correctCount,
|
||||
matureCorrect,
|
||||
matureCount,
|
||||
const againCount = answerCount - correctCount;
|
||||
let againCountText = i18n.tr(i18n.TR.STATISTICS_TODAY_AGAIN_COUNT);
|
||||
againCountText += ` ${againCount} (${((againCount / answerCount) * 100).toFixed(
|
||||
2
|
||||
)}%)`;
|
||||
const typeCounts = i18n.tr(i18n.TR.STATISTICS_TODAY_TYPE_COUNTS, {
|
||||
learnCount,
|
||||
reviewCount,
|
||||
relearnCount,
|
||||
earlyReviewCount,
|
||||
filteredCount: earlyReviewCount,
|
||||
});
|
||||
let matureText: string;
|
||||
if (matureCount) {
|
||||
matureText = i18n.tr(i18n.TR.STATISTICS_TODAY_CORRECT_MATURE, {
|
||||
correct: matureCorrect,
|
||||
total: matureCount,
|
||||
percent: (matureCorrect / matureCount) * 100,
|
||||
});
|
||||
} else {
|
||||
matureText = i18n.tr(i18n.TR.STATISTICS_TODAY_NO_MATURE_CARDS);
|
||||
}
|
||||
|
||||
lines = [studiedTodayText, againCountText, typeCounts, matureText];
|
||||
} else {
|
||||
lines = [i18n.tr(i18n.TR.STATISTICS_TODAY_NO_CARDS)];
|
||||
}
|
||||
|
||||
return {
|
||||
title: i18n.tr(i18n.TR.STATISTICS_TODAY_TITLE),
|
||||
lines,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue