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

Support for L10n #117

Open
geclick opened this issue Sep 6, 2021 · 0 comments
Open

Support for L10n #117

geclick opened this issue Sep 6, 2021 · 0 comments

Comments

@geclick
Copy link

geclick commented Sep 6, 2021

I needed to change de default locale to spanish in a DatePicker and I found no way to do this using alert.addDatePicker. I thought changing the device language it will work, but at least in simulator it didn't work. I didn't install the library with Cocoapods, so I added a modification to DatePickerViewController init

`required public init(mode: UIDatePicker.Mode, date: Date? = nil, minimumDate: Date? = nil, maximumDate: Date? = nil, action: Action?) {
super.init(nibName: nil, bundle: nil)
datePicker.datePickerMode = mode

    //changing to spanish only for date selection
   //so September 13, 2021 becomes 13 Septiembre 2021 
    if mode == .date{
        datePicker.locale = Locale(identifier: "es_ES")
    }
    
    datePicker.date = date ?? Date()
    datePicker.minimumDate = minimumDate
    datePicker.maximumDate = maximumDate
    self.action = action
}`

It would be nice if there were an option to set the locale of the picker

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

1 participant