Permalink
Browse files

Merge pull request #185 from yimajo/monthYear

Internationalizing the calendar grid.
  • Loading branch information...
Devin Ross
Devin Ross committed Aug 20, 2012
2 parents 0f83a6a + b8f73eb commit 7122b57002c279684f69fa8b66a68d85ddab57e1
@@ -79,6 +79,7 @@ typedef struct TKDateInformation TKDateInformation;
- (NSDate *) dateByAddingDays:(NSUInteger)days;
+ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime;
+- (NSString *) monthYearString;
- (NSString *) monthString;
- (NSString *) yearString;
@@ -120,6 +120,13 @@ + (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime {
}
+- (NSString *) monthYearString {
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ dateFormatter.dateFormat = [NSDateFormatter dateFormatFromTemplate:@"yMMMM"
+ options:0
+ locale:[NSLocale currentLocale]];
+ return [dateFormatter stringFromDate:self];
+}
- (NSString*) monthString{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
@@ -713,7 +713,7 @@ - (id) initWithSundayAsFirst:(BOOL)s{
[self addSubview:self.tileBox];
NSDate *date = [NSDate date];
- self.monthYear.text = [NSString stringWithFormat:@"%@ %@",[date monthString],[date yearString]];
+ self.monthYear.text = [date monthYearString];
[self addSubview:self.monthYear];
@@ -888,7 +888,7 @@ - (void) changeMonthAnimation:(UIView*)sender{
- monthYear.text = [NSString stringWithFormat:@"%@ %@",[localNextMonth monthString],[localNextMonth yearString]];
+ monthYear.text = [localNextMonth monthYearString];
@@ -952,7 +952,7 @@ - (void) selectDate:(NSDate*)date{
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.bounds.size.width, self.tileBox.frame.size.height+self.tileBox.frame.origin.y);
self.shadow.frame = CGRectMake(0, self.frame.size.height-self.shadow.frame.size.height+21, self.shadow.frame.size.width, self.shadow.frame.size.height);
- self.monthYear.text = [NSString stringWithFormat:@"%@ %@",[date monthString],[date yearString]];
+ self.monthYear.text = [date monthYearString];
[currentTile selectDay:info.day];
if([self.delegate respondsToSelector:@selector(calendarMonthView:monthDidChange:animated:)])

0 comments on commit 7122b57

Please sign in to comment.