Fscalendar: headerDateFormat and day name cannot be set to a fixed locale

Created on 3 Jul 2015  路  8Comments  路  Source: WenchaoD/FSCalendar

So in my app, I don't want any localization from happening.

But I cannot set the NSLocale in FSCalendar. Using NSDateFormatter.dateFormatFromTemplate to set the headerDateFormat does not work.

enhancement

Most helpful comment

I'm using swift with this code

self.calendar.appearance.headerDateFormat = NSDateFormatter.dateFormatFromTemplate("MMMM yyyy", options: 0, locale: NSLocale(localeIdentifier: "en-US"))

and the text is still not in English when the phone's language is not set to English. The zh-CN works at any language though..

All 8 comments

How did set it and what do you mean by don't want any localization

This is the screenshot when the phone's language is set to English:
screen shot 2015-07-03 at 13 00 54

This is the screenshot when the phone's language is set to French:
screen shot 2015-07-03 at 13 00 07

I want to make it fixed to English, so even when iOS language is set to French, the header text and day name is still English

This is the way I use it:

    _calendar.appearance.headerDateFormat = [NSDateFormatter dateFormatFromTemplate:@"MMMM yy" options:0 locale:[NSLocale localeWithLocaleIdentifier:@"zh-CN"]];

ios simulator screen shot jul 3 2015 2 15 05 pm

And you might try:

_calendar.appearance.headerDateFormat = [NSDateFormatter dateFormatFromTemplate:@"MMMM yy" options:0 locale:[NSLocale localeWithLocaleIdentifier:@"en-US"]];

BTW: green colors looks good~

I'm using swift with this code

self.calendar.appearance.headerDateFormat = NSDateFormatter.dateFormatFromTemplate("MMMM yyyy", options: 0, locale: NSLocale(localeIdentifier: "en-US"))

and the text is still not in English when the phone's language is not set to English. The zh-CN works at any language though..

Yes. Maybe a locale property is better, coz the weekday labels have locale names too.
But I still think that locale follow the iPhone system is a better performance --

locale property has been added, thanks~

TRY THIS THIS WILL WORK
calendar.calendarHeaderView.collectionViewLayout.collectionView?.semanticContentAttribute = .forceLeftToRight

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rintoandrews90 picture rintoandrews90  路  4Comments

thaoth58 picture thaoth58  路  3Comments

garudaonekh picture garudaonekh  路  4Comments

kunass2 picture kunass2  路  4Comments

ghost picture ghost  路  5Comments