mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-29 05:24:26 +00:00
Remove duplicate Sparkle localization strings in Updater app (#2288)
This commit is contained in:
10 files changed
+114
-20
No files matched your search
@@ -212,7 +212,6 @@
|
||||
724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; };
|
||||
724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
|
||||
724F76F91D6EAD0D00ECD062 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; };
|
||||
725264A91D5FBD9100CD6400 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
|
||||
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; };
|
||||
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
|
||||
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; };
|
||||
@@ -3141,7 +3140,6 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
725264A91D5FBD9100CD6400 /* Sparkle.strings in Resources */,
|
||||
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -28,6 +28,44 @@
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>LSUIElement</key>
|
||||
<string>1</string>
|
||||
<key>CFBundleLocalizations</key>
|
||||
<array>
|
||||
<string>en</string>
|
||||
<string>ca</string>
|
||||
<string>ar</string>
|
||||
<string>cs</string>
|
||||
<string>da</string>
|
||||
<string>de</string>
|
||||
<string>el</string>
|
||||
<string>en</string>
|
||||
<string>es</string>
|
||||
<string>fa</string>
|
||||
<string>fi</string>
|
||||
<string>fr</string>
|
||||
<string>he</string>
|
||||
<string>hr</string>
|
||||
<string>hu</string>
|
||||
<string>is</string>
|
||||
<string>it</string>
|
||||
<string>ja</string>
|
||||
<string>ko</string>
|
||||
<string>nb</string>
|
||||
<string>nl</string>
|
||||
<string>pl</string>
|
||||
<string>pt-BR</string>
|
||||
<string>pt-PT</string>
|
||||
<string>ro</string>
|
||||
<string>ru</string>
|
||||
<string>sk</string>
|
||||
<string>sl</string>
|
||||
<string>sv</string>
|
||||
<string>th</string>
|
||||
<string>tr</string>
|
||||
<string>uk</string>
|
||||
<string>zh_CN</string>
|
||||
<string>zh_HK</string>
|
||||
<string>zh_TW</string>
|
||||
</array>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
|
||||
@@ -119,6 +119,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
|
||||
_application = application;
|
||||
_delegate = delegate;
|
||||
|
||||
[delegate loadLocalizationStringsFromHost:host];
|
||||
|
||||
_connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
|
||||
_connection.exportedObject = self;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol InstallerProgressDelegate <NSObject>
|
||||
|
||||
- (void)loadLocalizationStringsFromHost:(SUHost *)host;
|
||||
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host;
|
||||
- (void)installerProgressShouldStop;
|
||||
|
||||
|
||||
+60
-3
@@ -19,15 +19,72 @@
|
||||
@end
|
||||
|
||||
@implementation ShowInstallerProgress
|
||||
{
|
||||
NSString *_updatingString;
|
||||
NSString *_cancelUpdateTitle;
|
||||
NSString *_installingUpdateTitle;
|
||||
}
|
||||
|
||||
@synthesize statusController = _statusController;
|
||||
|
||||
- (void)loadLocalizationStringsFromHost:(SUHost *)host
|
||||
{
|
||||
// Try to retrieve localization strings from the old bundle if possible
|
||||
// We won't display these strings until installerProgressShouldDisplayWithHost:
|
||||
// (which will be after the update is trusted)
|
||||
// If we fail to load localizations in any way, we default to English
|
||||
|
||||
NSBundle *hostSparkleBundle;
|
||||
{
|
||||
NSURL *hostSparkleURL = [host.bundle.privateFrameworksURL URLByAppendingPathComponent:@"Sparkle.framework" isDirectory:YES];
|
||||
if (hostSparkleURL == nil) {
|
||||
hostSparkleBundle = nil;
|
||||
} else {
|
||||
hostSparkleBundle = [NSBundle bundleWithURL:hostSparkleURL];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *updatingString;
|
||||
{
|
||||
NSString *updatingFormatStringFromBundle = (hostSparkleBundle != nil) ? SULocalizedStringFromTableInBundle(@"Updating %@", @"Sparkle", hostSparkleBundle, nil) : nil;
|
||||
|
||||
NSString *hostNameFromBundle = host.name;
|
||||
NSString *hostName = (hostNameFromBundle != nil) ? hostNameFromBundle : @"";
|
||||
|
||||
if (updatingFormatStringFromBundle != nil) {
|
||||
// Replacing the %@ will be a bit safer than using +[NSString stringWithFormat:]
|
||||
updatingString = [updatingFormatStringFromBundle stringByReplacingOccurrencesOfString:@"%@" withString:hostName];
|
||||
} else {
|
||||
updatingString = [@"Updating " stringByAppendingString:hostName];
|
||||
}
|
||||
}
|
||||
|
||||
_updatingString = updatingString;
|
||||
|
||||
NSString *cancelUpdateTitle;
|
||||
{
|
||||
NSString *cancelUpdateTitleFromBundle = (hostSparkleBundle != nil) ? SULocalizedStringFromTableInBundle(@"Cancel Update", @"Sparkle", hostSparkleBundle, @"") : nil;
|
||||
cancelUpdateTitle = (cancelUpdateTitleFromBundle != nil) ? cancelUpdateTitleFromBundle : @"Cancel Update";
|
||||
}
|
||||
|
||||
_cancelUpdateTitle = cancelUpdateTitle;
|
||||
|
||||
NSString *installingUpdateTitle;
|
||||
{
|
||||
NSString *installingUpdateTitleFromBundle = (hostSparkleBundle != nil) ? SULocalizedStringFromTableInBundle(@"Installing update…", @"Sparkle", hostSparkleBundle, @"") : nil;
|
||||
installingUpdateTitle = (installingUpdateTitleFromBundle != nil) ? installingUpdateTitleFromBundle : @"Installing update…";
|
||||
}
|
||||
|
||||
_installingUpdateTitle = installingUpdateTitle;
|
||||
}
|
||||
|
||||
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host
|
||||
{
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:host centerPointValue:nil minimizable:NO closable:NO];
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:host windowTitle:_updatingString centerPointValue:nil minimizable:NO closable:NO];
|
||||
|
||||
[self.statusController setButtonTitle:_cancelUpdateTitle target:nil action:nil isDefault:NO];
|
||||
[self.statusController beginActionWithTitle:_installingUpdateTitle maxProgressValue:0 statusText:@""];
|
||||
|
||||
[self.statusController setButtonTitle:SULocalizedString(@"Cancel Update", @"") target:nil action:nil isDefault:NO];
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update…", @"") maxProgressValue:0 statusText:@""];
|
||||
[self.statusController showWindow:self];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -508,7 +508,7 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3
|
||||
|
||||
self.cancellation = cancellation;
|
||||
|
||||
self.checkingController = [[SUStatusController alloc] initWithHost:self.host centerPointValue:nil minimizable:NO closable:NO];
|
||||
self.checkingController = [[SUStatusController alloc] initWithHost:self.host windowTitle:[NSString stringWithFormat:SULocalizedString(@"Updating %@", nil), [self.host name]] centerPointValue:nil minimizable:NO closable:NO];
|
||||
[[self.checkingController window] center]; // Force the checking controller to load its window.
|
||||
[self.checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates…", nil) maxProgressValue:0.0 statusText:nil];
|
||||
[self.checkingController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO];
|
||||
@@ -676,7 +676,7 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3
|
||||
centerPointValue = nil;
|
||||
}
|
||||
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:self.host centerPointValue:centerPointValue minimizable:minimizable closable:closable];
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:self.host windowTitle:[NSString stringWithFormat:SULocalizedString(@"Updating %@", nil), [self.host name]] centerPointValue:centerPointValue minimizable:minimizable closable:closable];
|
||||
|
||||
if (_updateAlertWindowWasInactive) {
|
||||
[self.statusController.window orderFront:nil];
|
||||
|
||||
Vendored
+3
-1
@@ -11,6 +11,8 @@
|
||||
|
||||
#import "SUConstants.h"
|
||||
|
||||
#define SULocalizedString(key, comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", (NSBundle * _Nonnull)([NSBundle bundleWithIdentifier:SUBundleIdentifier] ? [NSBundle bundleWithIdentifier:SUBundleIdentifier] : [NSBundle mainBundle]), comment)
|
||||
#define SULocalizedStringFromTableInBundle(key, tbl, bundle, comment) NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment)
|
||||
|
||||
#define SULocalizedString(key, comment) SULocalizedStringFromTableInBundle(key, @"Sparkle", (NSBundle * _Nonnull)([NSBundle bundleWithIdentifier:SUBundleIdentifier] ? [NSBundle bundleWithIdentifier:SUBundleIdentifier] : [NSBundle mainBundle]), comment)
|
||||
|
||||
#endif /* SULocalizations_h */
|
||||
Vendored
+2
-5
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -103,9 +103,6 @@
|
||||
<constraint firstItem="8" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="tAo-wJ-XR0"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<binding destination="-2" name="title" keyPath="windowTitle" id="24"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-158" y="132"/>
|
||||
</window>
|
||||
</objects>
|
||||
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@
|
||||
@property (nonatomic) double maxProgressValue;
|
||||
@property (getter=isButtonEnabled) BOOL buttonEnabled;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)aHost centerPointValue:(NSValue *)centerPointValue minimizable:(BOOL)minimizable closable:(BOOL)closable;
|
||||
- (instancetype)initWithHost:(SUHost *)aHost windowTitle:(NSString *)windowTitle centerPointValue:(NSValue *)centerPointValue minimizable:(BOOL)minimizable closable:(BOOL)closable;
|
||||
|
||||
// Pass 0 for the max progress value to get an indeterminate progress bar.
|
||||
// Pass nil for the status text to not show it.
|
||||
|
||||
Vendored
+5
-6
@@ -26,6 +26,7 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL
|
||||
|
||||
@implementation SUStatusController
|
||||
{
|
||||
NSString *_windowTitle;
|
||||
NSValue *_centerPointValue;
|
||||
BOOL _closable;
|
||||
}
|
||||
@@ -42,7 +43,7 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL
|
||||
@synthesize touchBarButton;
|
||||
@synthesize minimizable = _minimizable;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)aHost centerPointValue:(NSValue *)centerPointValue minimizable:(BOOL)minimizable closable:(BOOL)closable
|
||||
- (instancetype)initWithHost:(SUHost *)aHost windowTitle:(NSString *)windowTitle centerPointValue:(NSValue *)centerPointValue minimizable:(BOOL)minimizable closable:(BOOL)closable
|
||||
{
|
||||
self = [super initWithWindowNibName:@"SUStatus" owner:self];
|
||||
if (self)
|
||||
@@ -51,6 +52,7 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL
|
||||
_centerPointValue = centerPointValue;
|
||||
_minimizable = minimizable;
|
||||
_closable = closable;
|
||||
_windowTitle = [windowTitle copy];
|
||||
[self setShouldCascadeWindows:NO];
|
||||
}
|
||||
return self;
|
||||
@@ -77,11 +79,8 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL
|
||||
}
|
||||
[self.progressBar setUsesThreadedAnimation:YES];
|
||||
[self.statusTextField setFont:[NSFont monospacedDigitSystemFontOfSize:0 weight:NSFontWeightRegular]];
|
||||
}
|
||||
|
||||
- (NSString *)windowTitle
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"Updating %@", nil), [self.host name]];
|
||||
|
||||
self.window.title = _windowTitle;
|
||||
}
|
||||
|
||||
- (NSImage *)applicationIcon
|
||||
|
||||
Reference in new issue
Block a user