prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.92k stars 1.32k forks source link

Question - Gregorian To Shamsi #23

Closed TurKurT656 closed 8 years ago

TurKurT656 commented 9 years ago

Hi, This is an amzing library. I really loved it Is this calendar supports converting Gregorian to Shamsi? I want to use this lib for a Persian language based application

dandc87 commented 9 years ago

Hey @TurKurT656, the library uses Java's Calendar.getInstance() to get and manipulate calendar information, and it does not look like it has support for the Shamsi system. I'm not sure what it would take to support this and would not be confident in implementing a calendar system I'm not familiar with. Help would be welcome and appreciated with this.

In the interim, there are ways to convert Gregorian to Shamsi. For instance, I found this Stack Overflow post after a little searching (http://stackoverflow.com/questions/10378764/is-there-any-library-or-algorithm-for-persian-shamsi-or-jalali-calendar-in-and). Maybe something there can help you?

TurKurT656 commented 9 years ago

Thnx for replay. can we change the localization with help of this answer in StackOverFlow: http://stackoverflow.com/a/23386074/4254527

dandc87 commented 9 years ago

The answer you pointed to uses an IBM library that is meant to support different languages and cultures, but isn't directly compatible with the plain Java implementations. That means we'd have to include a very large library, which is not acceptable.

A better solution would be something like the accepted answer to that question, which is a Jalali implementation of Calendar. We could construct a way to supply custom implementations of Calendar for the library to use. Though it would have to be provided either as a constructor parameter or subclassing, since we need calendar information to initialize the widget.