ios - Do I have to hard-code / localise myself the "OK" button when generating an alert in swift? -


i have convenience method in swift (ios 8+) displaying error message. far looks this:

// supplied category code , error code, generates error dialogue box. // codes rather strings because needs localisable. func showerrordialogue(categorycode: string, _ errorcode: string) -> () {     // fetch actual strings localisation database.     let localisedcategory = nslocalizedstring(categorycode, comment: categorycode)     let localisederror    = nslocalizedstring(errorcode,    comment: errorcode)      // create alert box     let alertcontroller = uialertcontroller(         title:          localisedcategory,         message:        localisederror,         preferredstyle: .alert     )     alertcontroller.addaction(         uialertaction(             title:   "ok", // fixme: why isn't localised?             style:   .default,             handler: { (action) in return }         )     )     self.presentviewcontroller(alertcontroller, animated: true) { return } } 

it seems odd can't "i'm adding 1 button alert box, please assume it's going locale-default ok button". best solution i've found far limited googling appears steal them system , hope more little dodgy.

as far know, there no better ways stealing system found.

though it's not hardest thing localize, agree great if apple made automatic in future version of os.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -