Change all calls to NSAlert alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat: to reflect the fact that informativeTextWithFormat: requires a _format_ string. Ignoring this was triggering errors when non-ASCII localized text was used for the informativeText.

This commit is contained in:
Greg Neagle
2014-08-07 14:32:09 -07:00
parent 9d4c21a1c2
commit 617115649e
3 changed files with 19 additions and 20 deletions
@@ -88,7 +88,7 @@ class AlertController(NSObject):
self._force_warning_btns[NSAlertDefaultReturn],
self._force_warning_btns[NSAlertAlternateReturn],
nil,
infoText)
u"%@", infoText)
alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
self.window, self, self.forceLogoutWarningDidEnd_returnCode_contextInfo_, nil)
@@ -111,7 +111,7 @@ class AlertController(NSObject):
NSLocalizedString(u"OK", u"OK button title"),
nil,
nil,
NSLocalizedString(
u"%@", NSLocalizedString(
(u"There are additional pending updates to install or remove."),
u"Additional Pending Updates detail"))
alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
@@ -133,7 +133,7 @@ class AlertController(NSObject):
NSLocalizedString(u"Log out and update", u"Log out and Update button text"),
NSLocalizedString(u"Cancel", u"Cancel button title"),
nil,
NSLocalizedString(
u"%@", NSLocalizedString(
(u"A restart is required after updating. Please be patient "
"as there may be a short delay at the login window. Log "
"out and update now?"), u"Restart Required detail"))
@@ -146,7 +146,7 @@ class AlertController(NSObject):
NSLocalizedString(u"Log out and update", u"Log out and Update button text"),
NSLocalizedString(u"Cancel", u"Cancel button title"),
nil,
NSLocalizedString(
u"%@", NSLocalizedString(
(u"A logout is required before updating. Please be patient "
"as there may be a short delay at the login window. Log "
"out and update now?"), u"Logout Required detail"))
@@ -188,7 +188,7 @@ class AlertController(NSObject):
NSLocalizedString(u"Cancel", u"Cancel button title"),
nil,
nil,
NSLocalizedString(
u"%@", NSLocalizedString(
(u"There are other users logged into this computer.\n"
"Updating now could cause other users to lose their "
"work.\n\nPlease try again later after the other users "
@@ -223,31 +223,30 @@ class AlertController(NSObject):
if item['user'] != current_user]
my_apps = [item['display_name'] for item in running_apps
if item['user'] == current_user]
msulog.log("MSC", "conflicting_apps", ','.join(other_users_apps + my_apps))
if other_users_apps:
detailText = NSLocalizedString(
(u"Other logged in users are using the following applications. "
"Try updating later when they are no longer in use:\n\n%s"),
u"Other Users Blocking Apps Running detail")
alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
NSLocalizedString(
u"Applications in use by others", u"Other Users Blocking Apps Running title"),
NSLocalizedString(u"OK", u'OKButtonText'),
nil,
nil,
NSLocalizedString(
(u"Other logged in users are using the following applications. "
"Try updating later when they are no longer in use:\n\n%s"),
u"Other Users Blocking Apps Running detail")
% '\n'.join(set(other_users_apps)))
u"%@", detailText % u'\n'.join(set(other_users_apps)))
else:
detailText = NSLocalizedString((u"You must quit the following applications before "
"proceeding with installation or removal:\n\n%s"),
u"Blocking Apps Running detail")
alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
NSLocalizedString(
u"Conflicting applications running", u"Blocking Apps Running title"),
NSLocalizedString(u"OK", u"OK button title"),
nil,
nil,
NSLocalizedString(
(u"You must quit the following applications before "
"proceeding with installation or removal:\n\n%s"),
u"Blocking Apps Running detail")
% '\n'.join(set(my_apps)))
msulog.log("MSC", "conflicting_apps", ','.join(other_users_apps + my_apps))
u"%@", detailText % u'\n'.join(set(my_apps)))
alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
self.window, self,
self.blockingAppsRunningAlertDidEnd_returnCode_contextInfo_,
@@ -329,7 +328,7 @@ class AlertController(NSObject):
NSLocalizedString(u"Continue", u"Continue button text"),
NSLocalizedString(u"Cancel", u"Cancel button title"),
nil,
NSLocalizedString(
u"%@", NSLocalizedString(
(u"For best results, you should connect your computer to a "
"power source before updating. Are you sure you want to "
"continue the update?"), u"No Power Source Warning detail"))
@@ -113,7 +113,7 @@ class MSUMainWindowController(NSWindowController):
NSLocalizedString(u"Quit", u"Quit button title"),
nil,
NSLocalizedString(u"Update now", u"Update Now button title"),
alertDetail)
u"%@", alertDetail)
alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
self.window(), self,
self.updateAlertDidEnd_returnCode_contextInfo_, objc.nil)
@@ -217,7 +217,7 @@ class MSUMainWindowController(NSWindowController):
# show the alert sheet
self.window().makeKeyAndOrderFront_(self)
alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
alertMessageText, OKButtonTitle, nil, nil, detailText)
alertMessageText, OKButtonTitle, nil, nil, u"%@", detailText)
alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
self.window(), self,
self.munkiSessionErrorAlertDidEnd_returnCode_contextInfo_, nil)
@@ -206,7 +206,7 @@ class MSUStatusController(NSObject):
NSLocalizedString(u"Restart", u"Restart button title"),
nil,
nil,
NSLocalizedString(
u"%@", NSLocalizedString(
u"Software installed or removed requires a restart. You will "
"have a chance to save open documents.", u"Restart Required alert detail"))
alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(