aleksanderwozniak / table_calendar

Highly customizable, feature-packed calendar widget for Flutter
Apache License 2.0
1.84k stars 1k forks source link

Is it possible to add support for Bikram Sambat Calendar #205

Closed paurakhsharma closed 4 years ago

paurakhsharma commented 4 years ago

I am building a flutter app with internalization support. I have support for the Nepali language. I have added the translations for events but I was wondering if I could change the calendar as well to Nepali. Similar to https://pub.dev/packages/nepali_date_picker

I understand this is difficult and probably not worthy to be added to the library.

So, can you please suggest to me how I could implement this without official support in the library?

aleksanderwozniak commented 4 years ago

You can get something like the picture above when you pass 'ne' as locale.

The next thing you can do is either hide the header button by adding formatButtonVisible: false to HeaderStyle, or add your translation manually:

availableCalendarFormats: {
  // add your translation here
  CalendarFormat.month: 'Month', 
  CalendarFormat.twoWeeks: '2 weeks', 
  CalendarFormat.week: 'Week', 
},

The last step would be to change how each day is displayed. You can use CalendarBuilders for that - check example project for more details. I think you will need to make a method which takes in a number (date.day) and returns a proper String in Nepali.

paurakhsharma commented 4 years ago

@aleksanderwozniak Awesome! Thank you, this should solve most of my problem