i18n today section

This commit is contained in:
Damien Elmes 2020-06-27 20:31:33 +10:00
parent 41d77b0255
commit 01f3a71f0a
4 changed files with 99 additions and 95 deletions

View file

@ -3,75 +3,77 @@ statistics-due-date = Due
# The count of cards waiting to be reviewed
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}
statistics-due-for-new-card = New #{ $number }
## eg 16.8s (3.6 cards/minute)
statistics-cards-per-min = {$cards-per-minute} cards/minute
statistics-average-answer-time = {$average-seconds}s ({ statistics-cards-per-min })
statistics-cards-per-min = { $cards-per-minute } cards/minute
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 ->
[one] in {$amount} second
*[other] in {$amount} seconds
}
statistics-in-time-span-minutes = { $amount ->
[one] in {$amount} minute
*[other] in {$amount} minutes
}
statistics-in-time-span-hours = { $amount ->
[one] in {$amount} hour
*[other] in {$amount} hours
}
statistics-in-time-span-days = { $amount ->
[one] in {$amount} day
*[other] in {$amount} days
}
statistics-in-time-span-months = { $amount ->
[one] in {$amount} month
*[other] in {$amount} months
}
statistics-in-time-span-years = { $amount ->
[one] in {$amount} year
*[other] in {$amount} years
}
##
statistics-cards = { $cards ->
[one] {$cards} card
*[other] {$cards} cards
}
statistics-in-time-span-seconds =
{ $amount ->
[one] in { $amount } second
*[other] in { $amount } seconds
}
statistics-in-time-span-minutes =
{ $amount ->
[one] in { $amount } minute
*[other] in { $amount } minutes
}
statistics-in-time-span-hours =
{ $amount ->
[one] in { $amount } hour
*[other] in { $amount } hours
}
statistics-in-time-span-days =
{ $amount ->
[one] in { $amount } day
*[other] in { $amount } days
}
statistics-in-time-span-months =
{ $amount ->
[one] in { $amount } month
*[other] in { $amount } months
}
statistics-in-time-span-years =
{ $amount ->
[one] in { $amount } year
*[other] in { $amount } years
}
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 ->
[one] 1 review
*[other] {$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
# version unmodified.
statistics-studied-today =
Studied { statistics-cards }
{ $unit ->
[seconds] { statistics-in-time-span-seconds }
[minutes] { statistics-in-time-span-minutes }
[hours] { statistics-in-time-span-hours }
[days] { statistics-in-time-span-days }
[months] { statistics-in-time-span-months }
*[years] { statistics-in-time-span-years }
} today
({$secs-per-card}s/card)
Studied { statistics-cards }
{ $unit ->
[seconds] { statistics-in-time-span-seconds }
[minutes] { statistics-in-time-span-minutes }
[hours] { statistics-in-time-span-hours }
[days] { statistics-in-time-span-days }
[months] { statistics-in-time-span-months }
*[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 }%)

View file

@ -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}

View file

@ -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;
}

View file

@ -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
}
}
const studiedTodayText = studiedToday(i18n, answerCount, answerMillis / 1000);
let lines: string[];
if (answerCount) {
const studiedTodayText = studiedToday(i18n, answerCount, answerMillis / 1000);
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,
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 {
studiedToday: studiedTodayText,
correctCount,
matureCorrect,
matureCount,
learnCount,
reviewCount,
relearnCount,
earlyReviewCount,
title: i18n.tr(i18n.TR.STATISTICS_TODAY_TITLE),
lines,
};
}