Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headerDateFormat and day name cannot be set to a fixed locale #40

Closed
hendryl opened this issue Jul 3, 2015 · 8 comments
Closed

headerDateFormat and day name cannot be set to a fixed locale #40

hendryl opened this issue Jul 3, 2015 · 8 comments

Comments

@hendryl
Copy link

hendryl commented Jul 3, 2015

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.

@WenchaoD
Copy link
Owner

WenchaoD commented Jul 3, 2015

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

@hendryl
Copy link
Author

hendryl commented Jul 3, 2015

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

@WenchaoD
Copy link
Owner

WenchaoD commented Jul 3, 2015

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

@WenchaoD
Copy link
Owner

WenchaoD commented Jul 3, 2015

And you might try:

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

BTW: green colors looks good~

@hendryl
Copy link
Author

hendryl commented Jul 3, 2015

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..

@WenchaoD
Copy link
Owner

WenchaoD commented Jul 3, 2015

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 --

@WenchaoD
Copy link
Owner

locale property has been added, thanks~

@wasimpris
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants