react-scheduler / react-big-schedule

React Big Schedule is a powerful and intuitive scheduler and resource planning solution built with React.
https://react-big-schedule.vercel.app/
MIT License
79 stars 18 forks source link

Cant seem to change the locale to any other language instead stuck in spanish #146

Open younesnouri opened 3 months ago

younesnouri commented 3 months ago

Checklist

Please make sure the question is worded well enough to be understood

I'm encountering an issue with the React Big Scheduler where the language/locale appears to be stuck in Spanish as Default, despite my attempts to change it to a different language, such as French. Here is my attempt to change it : import dayjs from 'dayjs'; import * as dayjsLocale from 'dayjs/locale/fr'; import quarterOfYear from 'dayjs/plugin/quarterOfYear'; import utc from 'dayjs/plugin/utc'; import weekday from 'dayjs/plugin/weekday'; import { RRuleSet, rrulestr } from 'rrule'; import config from '../config/scheduler'; import behaviors from '../helper/behaviors'; import { ViewType, CellUnit, DATE_FORMAT, DATETIME_FORMAT } from '../config/default';

dayjs.locale(dayjsLocale);

export default class SchedulerData { constructor(date = dayjs(), viewType = ViewType.Week, showAgenda = false, isEventPerspective = false, newConfig = undefined, newBehaviors = undefined,localeDayjs = dayjsLocale) { this.resources = []; this.events = []; this.eventGroups = []; this.eventGroupsAutoGenerated = true; this.viewType = viewType; this.cellUnit = viewType === ViewType.Day ? CellUnit.Hour : CellUnit.Day; this.showAgenda = showAgenda; this.isEventPerspective = isEventPerspective; this.resizing = false; this.scrollToSpecialDayjs = false; this.documentWidth = 0; this._shouldReloadViewType = false; this.localeDayjs = localeDayjs;

this.calendarPopoverLocale = undefined;
dayjs.extend(quarterOfYear);
dayjs.extend(weekday);
dayjs.extend(utc);
this.localeDayjs = dayjs;
this.config = newConfig === undefined ? config : { ...config, ...newConfig };
this._validateMinuteStep(this.config.minuteStep);
this.behaviors = newBehaviors === undefined ? behaviors : { ...behaviors, ...newBehaviors };
this._resolveDate(0, date);
this._createHeaders();
this._createRenderData();

}

setSchedulerLocale(fr) { if (!fr) return;

this.localeDayjs.locale(fr);
this._shouldReloadViewType = true;
this.setViewType(this.viewType, this.showAgenda, this.isEventPerspective);

}

setCalendarPopoverLocale(fr) { if (fr) { this.calendarPopoverLocale = fr; } }