add translation for buttons: calendar

This commit is contained in:
Nriver 2024-07-31 10:46:31 +08:00
parent 02ecdf565e
commit b99510ad4f
3 changed files with 60 additions and 15 deletions

View File

@ -1,3 +1,4 @@
import { t } from "../../services/i18n.js";
import libraryLoader from "../../services/library_loader.js";
import utils from "../../services/utils.js";
import dateNoteService from "../../services/date_notes.js";
@ -23,7 +24,7 @@ const DROPDOWN_TPL = `
</div>
<div class="calendar-week">
<span>Mon</span> <span>Tue</span><span>Wed</span> <span>Thu</span> <span>Fri</span> <span>Sat</span> <span>Sun</span>
<span>${t("calendar.mon")}</span> <span>${t("calendar.tue")}</span><span>${t("calendar.wed")}</span> <span>${t("calendar.thu")}</span> <span>${t("calendar.fri")}</span> <span>${t("calendar.sat")}</span> <span>${t("calendar.sun")}</span>
</div>
<div class="calendar-body" data-calendar-area="month"></div>
</div>`;
@ -63,7 +64,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
this.hideDropdown();
}
else {
toastService.showError("Cannot find day note");
toastService.showError(t("calendar.cannot_find_day_note"));
}
});
}
@ -153,23 +154,23 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
this.date.setDate(1);
this.date.setMonth(this.date.getMonth() - 1);
this.$label.html(`${this.monthsAsString(this.date.getMonth())} ${this.date.getFullYear()}`);
this.$label.html(`${t(this.monthsAsString(this.date.getMonth()).toLowerCase())} ${this.date.getFullYear()}`);
}
monthsAsString(monthIndex) {
return [
'January',
'Febuary',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
t("calendar.january"),
t("calendar.febuary"),
t("calendar.march"),
t("calendar.april"),
t("calendar.may"),
t("calendar.june"),
t("calendar.july"),
t("calendar.august"),
t("calendar.september"),
t("calendar.october"),
t("calendar.november"),
t("calendar.december")
][monthIndex];
}
}

View File

@ -527,5 +527,27 @@
"convert_confirm": "您确定要将附件 '{{title}}' 转换为单独的笔记吗?",
"convert_success": "附件 '{{title}}' 已转换为笔记。",
"enter_new_name": "请输入附件的新名称"
},
"calendar": {
"mon": "一",
"tue": "二",
"wed": "三",
"thu": "四",
"fri": "五",
"sat": "六",
"sun": "日",
"cannot_find_day_note": "无法找到日记",
"january": "一月",
"febuary": "二月",
"march": "三月",
"april": "四月",
"may": "五月",
"june": "六月",
"july": "七月",
"august": "八月",
"september": "九月",
"october": "十月",
"november": "十一月",
"december": "十二月"
}
}

View File

@ -528,5 +528,27 @@
"convert_success": "Attachment '{{title}}' has been converted to note.",
"rename_attachment": "Rename attachment",
"enter_new_name": "Please enter new attachment's name"
},
"calendar": {
"mon": "Mon",
"tue": "Tue",
"wed": "Wed",
"thu": "Thu",
"fri": "Fri",
"sat": "Sat",
"sun": "Sun",
"cannot_find_day_note": "Cannot find day note",
"january": "January",
"febuary": "Febuary",
"march": "March",
"april": "April",
"may": "May",
"june": "June",
"july": "July",
"august": "August",
"september": "September",
"october": "October",
"november": "November",
"december": "December"
}
}