Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default [
globals: {
foundry: 'readonly',
game: 'readonly',
_loc: 'readonly',
_del: 'readonly',
ui: 'readonly',
Hooks: 'readonly',
CONFIG: 'readonly',
Expand Down
286 changes: 278 additions & 8 deletions lang/es.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@
"CALENDARIA.Editor.Cycle.BasedOn.Day": "Dzień Bezwzględny",
"CALENDARIA.Editor.Cycle.BasedOn.MonthDay": "Dzień Miesiąca",
"CALENDARIA.Editor.Cycle.BasedOn.Year": "Rok Kalendarzowy",
"CALENDARIA.Editor.DaysPerYear.Hint": "Łączna liczba dni w każdym roku, wykorzystywana do nawigacji i obliczeń dat.",
"CALENDARIA.Editor.DaysPerYear.Label": "Dni w roku",
"CALENDARIA.Editor.Default.CanonicalHourName": "Godzina {num}",
"CALENDARIA.Editor.Default.CycleName": "Cykl {num}",
"CALENDARIA.Editor.Default.CycleStage": "Etap {num}",
Expand All @@ -612,6 +614,7 @@
"CALENDARIA.Editor.Error.MinOneWeekday": "Kalendarz musi mieć co najmniej jeden dzień tygodnia.",
"CALENDARIA.Editor.Error.NameRequired": "Kalendarz musi mieć nazwę.",
"CALENDARIA.Editor.ExportSuccess": "Pomyślnie wyeksportowano \"{name}\".",
"CALENDARIA.Editor.Festival.PendingImport": "Po zapisaniu tego kalendarza zostaną utworzone {count} importowane święta. Przejrzyj pozostałe zakładki, a następnie ponownie otwórz kalendarz, aby je edytować.",
"CALENDARIA.Editor.Festival.ResetConfirm": "Czy chcesz usunąć wszystkie notatki dotyczące świąt z tego kalendarza i utworzyć je ponownie na podstawie dołączonego szablonu?",
"CALENDARIA.Editor.Festival.ResetDone": "Reset zakończony. Wprowadzono {count} notatek dotyczących festiwalu z dołączonego szablonu.",
"CALENDARIA.Editor.Festival.ResetLabel": "Przywróć ustawienia domyślne",
Expand Down
3 changes: 3 additions & 0 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@
"CALENDARIA.Editor.Cycle.BasedOn.Day": "Dia Absoluto",
"CALENDARIA.Editor.Cycle.BasedOn.MonthDay": "Dia do Mês",
"CALENDARIA.Editor.Cycle.BasedOn.Year": "Ano do Calendário",
"CALENDARIA.Editor.DaysPerYear.Hint": "Total de dias em cada ano, utilizado para navegação e cálculos de datas.",
"CALENDARIA.Editor.DaysPerYear.Label": "Dias Por Ano",
"CALENDARIA.Editor.Default.CanonicalHourName": "Hora {num}",
"CALENDARIA.Editor.Default.CycleName": "Ciclo {num}",
"CALENDARIA.Editor.Default.CycleStage": "Estágio {num}",
Expand All @@ -612,6 +614,7 @@
"CALENDARIA.Editor.Error.MinOneWeekday": "O calendário deve ter pelo menos um dia de semana.",
"CALENDARIA.Editor.Error.NameRequired": "O calendário deve ter um nome.",
"CALENDARIA.Editor.ExportSuccess": "\"{name}\" exportado com sucesso.",
"CALENDARIA.Editor.Festival.PendingImport": "{count} festivais importados serão criados quando você salvar este calendário. Revise as outras abas e, em seguida, reabra o calendário para editá-los.",
"CALENDARIA.Editor.Festival.ResetConfirm": "Excluir todas as notas de festivais deste calendário e recriá-las a partir do modelo incluído?",
"CALENDARIA.Editor.Festival.ResetDone": "Reinicialização concluída. {count} notas de festival foram inseridas a partir do modelo incluído.",
"CALENDARIA.Editor.Festival.ResetLabel": "Redefinir para o Padrão",
Expand Down
1 change: 1 addition & 0 deletions lang/ta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"bugs": "https://github.com/Sayshal/calendaria/issues",
"changelog": "https://github.com/Sayshal/calendaria/releases",
"compatibility": {
"minimum": "13.351",
"verified": "14.361"
"minimum": "14",
"verified": "14.364"
},
"description": "A FVTT Module to handle calendar operations, passage of real time, and automated effect expiry.",
"documentTypes": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ export const CalendariaAPI = {
formClass: '',
year: current.year,
isMonthless,
months: isMonthless ? [] : calendar.monthsArray.map((m, i) => ({ index: i, name: game.i18n.localize(m.name), selected: i === currentMonth })),
months: isMonthless ? [] : calendar.monthsArray.map((m, i) => ({ index: i, name: _loc(m.name), selected: i === currentMonth })),
days: Array.from({ length: maxDays }, (_, i) => i + 1),
currentDay,
showTime,
Expand All @@ -1213,7 +1213,7 @@ export const CalendariaAPI = {
maxMinute: minutesPerHour - 1
});
const dialogOptions = {
window: { title: options.title ?? game.i18n.localize('CALENDARIA.Note.SelectDateTitle') },
window: { title: options.title ?? _loc('CALENDARIA.Note.SelectDateTitle') },
content,
ok: {
callback: (_event, button) => {
Expand Down
58 changes: 28 additions & 30 deletions scripts/applications/calendar/big-cal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
buildWeatherPillData,
canViewBigCal,
enrichSeasonData,
format,
formatForLocation,
generateDayTooltip,
getAllMoonPhases,
Expand All @@ -41,7 +40,6 @@ import {
isFogEnabled,
isMonthFullyFogged,
isRevealed,
localize,
renderCycleIndicator,
renderEraIndicator,
renderMoonIcons,
Expand Down Expand Up @@ -333,7 +331,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
*/
_normalizeSeasonData(season) {
if (!season) return null;
return { name: localize(season.name), icon: season.icon || 'fas fa-sun', color: season.color || '#888' };
return { name: _loc(season.name), icon: season.icon || 'fas fa-sun', color: season.color || '#888' };
}

/**
Expand All @@ -343,7 +341,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
*/
_normalizeEraData(era) {
if (!era) return null;
return { name: localize(era.name), abbreviation: localize(era.abbreviation || era.name) };
return { name: _loc(era.name), abbreviation: _loc(era.abbreviation || era.name) };
}

/**
Expand Down Expand Up @@ -407,7 +405,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
.map((moon, index) => {
const phase = calendar.getMoonPhase(index, dayWorldTime);
if (!phase) return null;
return { moonName: localize(moon.name), phaseName: phase.subPhaseName || localize(phase.name), icon: phase.icon, color: moon.color || null };
return { moonName: _loc(moon.name), phaseName: phase.subPhaseName || _loc(phase.name), icon: phase.icon, color: moon.color || null };
})
.filter(Boolean)
.sort((a, b) => a.moonName.localeCompare(b.moonName));
Expand Down Expand Up @@ -496,7 +494,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
const festivalDay = calendar.findFestivalDay({ year: checkYear - yearZero, month: checkMonth, dayOfMonth: dayInMonth - 1 });
const skipFestival = festivalDay?.countsForWeekday === false && !isIntercalaryMonth;
if (!skipFestival) {
const monthName = isIntercalaryMonth ? localize(monthData?.name ?? '') : '';
const monthName = isIntercalaryMonth ? _loc(monthData?.name ?? '') : '';
currentWeek.push({
day: dayInMonth,
dayOfMonth: dayInMonth - 1,
Expand Down Expand Up @@ -529,7 +527,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
const currentEra = calendar.getCurrentEra?.();
const monthWeekdaysRaw = calendar.getWeekdaysForMonth?.(month) ?? calendar.weekdaysArray ?? [];
const monthWeekdays = monthWeekdaysRaw.length ? Array.from({ length: monthWeekdaysRaw.length }, (_, i) => monthWeekdaysRaw[(i + weekStartIdx) % monthWeekdaysRaw.length]) : monthWeekdaysRaw;
const weekdaysData = monthWeekdays.map((wd) => ({ name: localize(wd.name), isRestDay: wd.isRestDay || false }));
const weekdaysData = monthWeekdays.map((wd) => ({ name: _loc(wd.name), isRestDay: wd.isRestDay || false }));
const showSelectedInHeader = game.settings.get(MODULE.ID, SETTINGS.BIG_CAL_HEADER_SHOW_SELECTED);
const headerDate = showSelectedInHeader && this._selectedDate ? this._selectedDate : { year, month, dayOfMonth: date.dayOfMonth };
const headerComponents = { year: headerDate.year, month: headerDate.month, dayOfMonth: headerDate.dayOfMonth ?? 0 };
Expand All @@ -538,7 +536,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
return {
year,
month,
monthName: localize(monthData.name),
monthName: _loc(monthData.name),
yearDisplay: String(year),
formattedHeader,
formattedHeaderHtml: hasMoonIconMarkers(rawHeader),
Expand Down Expand Up @@ -598,7 +596,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
.map((moon, index) => {
const phase = calendar.getMoonPhase(index, dayWorldTime);
if (!phase) return null;
return { moonName: localize(moon.name), phaseName: phase.subPhaseName || localize(phase.name), icon: phase.icon, color: moon.color || null };
return { moonName: _loc(moon.name), phaseName: phase.subPhaseName || _loc(phase.name), icon: phase.icon, color: moon.color || null };
})
.filter(Boolean)
.sort((a, b) => a.moonName.localeCompare(b.moonName));
Expand All @@ -616,7 +614,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
isSelected: this._isSelected(dayYear, 0, dayOfMonth),
notes: dayNotes,
isFestival: !dayIsFogged && !!festivalDay,
festivalName: !dayIsFogged && festivalDay ? localize(festivalDay.name) : null,
festivalName: !dayIsFogged && festivalDay ? _loc(festivalDay.name) : null,
festivalColor: !dayIsFogged ? festivalDay?.color || '' : '',
festivalIcon: !dayIsFogged && festivalDay?.icon ? `fas ${festivalDay.icon}` : '',
festivalNoteId: dayIsFogged ? '' : festivalNoteId,
Expand All @@ -635,15 +633,15 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
const weekdayData = calendar.weekdaysArray ?? [];
const displayWeek = weekNumber + 1;
const yearDisplay = String(year);
const formattedHeader = `${localize('CALENDARIA.Common.Week')} ${displayWeek}, ${yearDisplay}`;
const formattedHeader = `${_loc('CALENDARIA.Common.Week')} ${displayWeek}, ${yearDisplay}`;
return {
year,
month: 0,
monthName: '',
yearDisplay,
formattedHeader,
weeks,
weekdays: weekdayData.map((wd) => ({ name: localize(wd.name), isRestDay: wd.isRestDay || false })),
weekdays: weekdayData.map((wd) => ({ name: _loc(wd.name), isRestDay: wd.isRestDay || false })),
daysInWeek,
currentSeason,
currentEra,
Expand Down Expand Up @@ -728,8 +726,8 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
const dayNotes = weekDayFogged ? [] : this._getNotesForDay(notes, currentYear, currentMonth, currentDayOfMonth);
const monthWeekdays = calendar.getWeekdaysForMonth?.(currentMonth) ?? calendar.weekdaysArray ?? [];
const weekdayData = monthWeekdays.length ? monthWeekdays[(weekdayIndex + weekStartIdx) % monthWeekdays.length] : null;
const dayName = weekdayData?.name ? localize(weekdayData.name) : '';
const monthName = calendar.monthsArray[currentMonth]?.name ? localize(calendar.monthsArray[currentMonth].name) : '';
const dayName = weekdayData?.name ? _loc(weekdayData.name) : '';
const monthName = calendar.monthsArray[currentMonth]?.name ? _loc(calendar.monthsArray[currentMonth].name) : '';
const isToday = this._isToday(currentYear, currentMonth, currentDayOfMonth);
const selectedHour =
this._selectedTimeSlot?.year === currentYear && this._selectedTimeSlot?.month === currentMonth && this._selectedTimeSlot?.dayOfMonth === currentDayOfMonth ? this._selectedTimeSlot.hour : null;
Expand Down Expand Up @@ -781,14 +779,14 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
return {
year: weekStartYear,
month: weekStartMonth,
monthName: calendar.monthsArray[month]?.name ? localize(calendar.monthsArray[month].name) : '',
monthName: calendar.monthsArray[month]?.name ? _loc(calendar.monthsArray[month].name) : '',
yearDisplay: String(weekStartYear),
formattedHeader,
formattedHeaderHtml: hasMoonIconMarkers(rawHeader),
weekNumber,
days: days,
timeSlots: timeSlots,
weekdays: weekWeekdays.map((wd) => ({ name: localize(wd.name), isRestDay: wd.isRestDay || false })),
weekdays: weekWeekdays.map((wd) => ({ name: _loc(wd.name), isRestDay: wd.isRestDay || false })),
daysInWeek,
hoursPerDay,
currentHour,
Expand Down Expand Up @@ -822,8 +820,8 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
isCurrent: displayYear === year,
months:
calendar.monthsArray.map((m, idx) => {
const localizedName = localize(m.name);
const localizedAbbrev = m.abbreviation ? localize(m.abbreviation) : localizedName;
const localizedName = _loc(m.name);
const localizedAbbrev = m.abbreviation ? _loc(m.abbreviation) : localizedName;
const abbrevData = this._abbreviateMonthName(localizedAbbrev);
const daysInMonth = calendar.getDaysInMonth(idx, displayYear - yearZero);
return {
Expand Down Expand Up @@ -1369,9 +1367,9 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
#getContextMenuItems() {
const items = [];
items.push({
name: 'CALENDARIA.BigCal.ContextMenu.Settings',
label: 'CALENDARIA.BigCal.ContextMenu.Settings',
icon: '<i class="fas fa-gear"></i>',
callback: () => {
onClick: () => {
const panel = new SettingsPanel();
panel.render(true).then(() => {
requestAnimationFrame(() => panel.changeTab('bigcal', 'primary'));
Expand All @@ -1382,17 +1380,17 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
if (game.user.isGM) {
const forceBigCal = game.settings.get(MODULE.ID, SETTINGS.FORCE_BIG_CAL);
items.push({
name: forceBigCal ? 'CALENDARIA.Common.HideFromAll' : 'CALENDARIA.Common.ShowToAll',
label: forceBigCal ? 'CALENDARIA.Common.HideFromAll' : 'CALENDARIA.Common.ShowToAll',
icon: `<i class="fas fa-${forceBigCal ? 'eye-slash' : 'eye'}"></i>`,
callback: async () => {
onClick: async () => {
const newValue = !forceBigCal;
if (newValue) warnShowToAll('viewBigCal', game.i18n.localize('CALENDARIA.Permissions.ViewBigCal'));
if (newValue) warnShowToAll('viewBigCal', _loc('CALENDARIA.Permissions.ViewBigCal'));
await game.settings.set(MODULE.ID, SETTINGS.FORCE_BIG_CAL, newValue);
CalendariaSocket.emit(SOCKET_TYPES.BIG_CAL_VISIBILITY, { visible: newValue });
}
});
}
items.push({ name: 'CALENDARIA.Common.Close', icon: '<i class="fas fa-times"></i>', callback: () => this.close() });
items.push({ label: 'CALENDARIA.Common.Close', icon: '<i class="fas fa-times"></i>', onClick: () => this.close() });
return items;
}

Expand Down Expand Up @@ -1684,7 +1682,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
const hoursPerDay = calendar?.days?.hoursPerDay ?? 24;
const endHour = (parseInt(hour) + 1) % hoursPerDay;
await NoteManager.createNote({
name: localize('CALENDARIA.Note.NewNote'),
name: _loc('CALENDARIA.Note.NewNote'),
noteData: {
startDate: { year: parseInt(year), month: parseInt(month), dayOfMonth: parseInt(dayOfMonth), hour: parseInt(hour), minute: 0 },
endDate: { year: parseInt(year), month: parseInt(month), dayOfMonth: parseInt(dayOfMonth), hour: endHour, minute: 0 }
Expand Down Expand Up @@ -1721,7 +1719,7 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
}
const endHour = (parseInt(hour) + 1) % hoursPerDay;
await NoteManager.createNote({
name: localize('CALENDARIA.Note.NewNote'),
name: _loc('CALENDARIA.Note.NewNote'),
noteData: {
startDate: { year: parseInt(year), month: parseInt(month), dayOfMonth: parseInt(dayOfMonth), hour: parseInt(hour), minute: parseInt(minute) },
endDate: { year: parseInt(year), month: parseInt(month), dayOfMonth: parseInt(dayOfMonth), hour: endHour, minute: parseInt(minute) }
Expand Down Expand Up @@ -1754,8 +1752,8 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
const page = journal?.pages.get(pageId);
if (page) {
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: { title: localize('CALENDARIA.Common.DeleteNote') },
content: `<p>${format('CALENDARIA.ContextMenu.DeleteConfirm', { name: page.name })}</p>`,
window: { title: _loc('CALENDARIA.Common.DeleteNote') },
content: `<p>${_loc('CALENDARIA.ContextMenu.DeleteConfirm', { name: page.name })}</p>`,
rejectClose: false,
modal: true
});
Expand Down Expand Up @@ -1894,15 +1892,15 @@ export class BigCal extends HandlebarsApplicationMixin(ApplicationV2) {
_getWeatherContext() {
const weather = WeatherManager.getCurrentWeather(null, game.scenes?.active);
if (!weather) return null;
const label = localize(weather.label);
const label = _loc(weather.label);
const windSpeed = weather.wind?.speed ?? 0;
const windDirection = weather.wind?.direction;
const precipType = weather.precipitation?.type ?? null;
const temp = WeatherManager.formatTemperature(WeatherManager.getTemperature());
const windKph = weather.wind?.kph ?? null;
const tooltipHtml = WeatherManager.buildWeatherTooltip({
label,
description: weather.description ? localize(weather.description) : null,
description: weather.description ? _loc(weather.description) : null,
temp,
windSpeed,
windKph,
Expand Down
Loading
Loading