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

How to change a language of days in your calendar? #51

Open
ZhannySunny opened this issue Nov 28, 2019 · 3 comments
Open

How to change a language of days in your calendar? #51

ZhannySunny opened this issue Nov 28, 2019 · 3 comments

Comments

@ZhannySunny
Copy link

Hello. I need to display days in calendar in Russian. How can I do it?

@IrinaAs
Copy link

IrinaAs commented Dec 19, 2019

Находите это место и вставляете строку calendar.locale = Locale(identifier: "ru_RU")
let defaultCalendar: Calendar = {
var calendar = Calendar.current
calendar.firstWeekday = 1
calendar.timeZone = TimeZone(secondsFromGMT: 0)!
calendar.locale = Locale(identifier: "ru_RU")
return calendar
}()

@satelite3131
Copy link

Unfortunately, only weekdays and month header view title change using this method but not the name of the months on the calendar itself.

@satelite3131
Copy link

Actually, I have found the proper solution

Just add these lines of code to the View Controller you are using Calendar in.

func verticalMonthDateFormater() -> DateFormatter {
    
    let formatter = DateFormatter()
    formatter.locale = Locale(identifier: "ru_RU")
    formatter.dateFormat = "LLLL yyyy"
    
    return formatter
}

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

No branches or pull requests

3 participants