mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Make weekday labels localizable
This commit is contained in:
parent
e91b80d270
commit
8e39ebb2f5
3 changed files with 18 additions and 3 deletions
|
@ -156,6 +156,13 @@ statistics-hours-subtitle = Review success rate for each hour of the day.
|
|||
# shown when graph is empty
|
||||
statistics-no-data = NO DATA
|
||||
statistics-calendar-title = Calendar
|
||||
statistics-calendar-label-sunday = S
|
||||
statistics-calendar-label-monday = M
|
||||
statistics-calendar-label-tuesday = T
|
||||
statistics-calendar-label-wednesday = W
|
||||
statistics-calendar-label-thursday = T
|
||||
statistics-calendar-label-friday = F
|
||||
statistics-calendar-label-saturday = S
|
||||
|
||||
## An amount of elapsed time, used in the graphs to show the amount of
|
||||
## time spent studying. For example, English would show "5s" for 5 seconds,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
let targetYear = maxYear;
|
||||
|
||||
$: if (sourceData) {
|
||||
graphData = gatherData(sourceData);
|
||||
graphData = gatherData(sourceData, i18n);
|
||||
}
|
||||
|
||||
$: {
|
||||
|
|
|
@ -41,7 +41,7 @@ interface DayDatum {
|
|||
date: Date;
|
||||
}
|
||||
|
||||
export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
|
||||
export function gatherData(data: pb.BackendProto.GraphsOut, i18n: I18n): GraphData {
|
||||
const reviewCount = new Map<number, number>();
|
||||
|
||||
for (const review of data.revlog as pb.BackendProto.RevlogEntry[]) {
|
||||
|
@ -64,7 +64,15 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
|
|||
? timeSaturday
|
||||
: timeSunday;
|
||||
|
||||
const weekdayLabels = ["S", "M", "T", "W", "T", "F", "S"];
|
||||
const weekdayLabels = [
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_SUNDAY),
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_MONDAY),
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_TUESDAY),
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_WEDNESDAY),
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_THURSDAY),
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_FRIDAY),
|
||||
i18n.tr(i18n.TR.STATISTICS_CALENDAR_LABEL_SATURDAY),
|
||||
];
|
||||
|
||||
for (let i = 0; i < data.firstWeekday; i++) {
|
||||
const shifted = weekdayLabels.shift() as string;
|
||||
|
|
Loading…
Reference in a new issue