Fix "User-facing text should use localized string macro" (#4030)

This commit is contained in:
A Cœur 2022-10-31 22:37:34 +08:00 committed by GitHub
parent d5ef1ea80a
commit 46eab5f3f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 8 deletions

View File

@ -3305,10 +3305,7 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
{
if (menu == self.fGroupsSetMenu || menu == self.fGroupsSetContextMenu)
{
for (NSInteger i = menu.numberOfItems - 1; i >= 0; i--)
{
[menu removeItemAtIndex:i];
}
[menu removeAllItems];
NSMenu* groupMenu = [GroupsController.groups groupMenuWithTarget:self action:@selector(setGroup:) isSmall:NO];

View File

@ -603,7 +603,7 @@ typedef NS_ENUM(unsigned int, filePriorityMenuTag) { //
- (NSMenu*)menu
{
NSMenu* menu = [[NSMenu alloc] initWithTitle:@"File Outline Menu"];
NSMenu* menu = [[NSMenu alloc] initWithTitle:@""];
//check and uncheck
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Check Selected", "File Outline -> Menu")
@ -631,7 +631,7 @@ typedef NS_ENUM(unsigned int, filePriorityMenuTag) { //
//priority
item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Priority", "File Outline -> Menu") action:NULL keyEquivalent:@""];
NSMenu* priorityMenu = [[NSMenu alloc] initWithTitle:@"File Priority Menu"];
NSMenu* priorityMenu = [[NSMenu alloc] initWithTitle:@""];
item.submenu = priorityMenu;
[menu addItem:item];

View File

@ -349,6 +349,7 @@ typedef NS_ENUM(NSInteger, FilterTypeTag) {
{
if (menu == self.fGroupsButton.menu)
{
//remove all items except first three
for (NSInteger i = menu.numberOfItems - 1; i >= 3; i--)
{
[menu removeItemAtIndex:i];

View File

@ -287,7 +287,7 @@ GroupsController* fGroupsInstance = nil;
- (NSMenu*)groupMenuWithTarget:(id)target action:(SEL)action isSmall:(BOOL)small
{
NSMenu* menu = [[NSMenu alloc] initWithTitle:@"Groups"];
NSMenu* menu = [[NSMenu alloc] initWithTitle:@""];
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"None", "Groups -> Menu") action:action
keyEquivalent:@""];

View File

@ -27,3 +27,8 @@
- (NSArray<NSString*>*)nonEmptyComponentsSeparatedByCharactersInSet:(NSCharacterSet*)separators;
@end
__attribute__((annotate("returns_localized_nsstring"))) static inline NSString* LocalizationNotNeeded(NSString* s)
{
return s;
}

View File

@ -4,12 +4,14 @@
@import ObjectiveC;
@import AppKit;
#import "NSStringAdditions.h"
// Development-only proxy when app is not signed for running Sparkle
void SUUpdater_checkForUpdates(id self, SEL _cmd, ...)
{
dispatch_async(dispatch_get_main_queue(), ^{
NSAlert* alert = [[NSAlert alloc] init];
alert.messageText = @"Sparkle not configured";
alert.messageText = LocalizationNotNeeded(@"Sparkle not configured");
alert.informativeText = [NSString
stringWithFormat:@"App needs to be codesigned for Development to support Sparkle with Hardened Runtime. Alternatively, re-codesign without the Hardened Runtime option: `sudo codesign -s - %@`",
NSBundle.mainBundle.bundleURL.lastPathComponent];