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

Fix localisation warnings #1812

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,839 changes: 1,338 additions & 501 deletions Vienna/Resources/Localizable.xcstrings

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Vienna/Sources/Alerts/SearchPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ -(void)runSearchPanel:(NSWindow *)window
self.topObjects = objects;
((NSSearchFieldCell *)searchField.cell).searchMenuTemplate = APPCONTROLLER.searchFieldMenu;
}
[searchLabel setStringValue:NSLocalizedString(@"Search", @"Search panel title")];
searchLabel.stringValue = NSLocalizedStringWithDefaultValue(@"search.window",
nil,
NSBundle.mainBundle,
@"Search",
@"Window title");
searchField.stringValue = APPCONTROLLER.searchString ? APPCONTROLLER.searchString : @"";
[window beginSheet:searchPanelWindow completionHandler:nil];
}
Expand Down
54 changes: 45 additions & 9 deletions Vienna/Sources/Application/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,11 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
alert.messageText = NSLocalizedString(@"One or more downloads are in progress", @"Message text of an alert");
alert.informativeText = NSLocalizedString(@"If you quit Vienna now, all downloads will stop.", @"Message text of an alert");
[alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a button on an alert")];
NSModalResponse alertResponse = [alert runModal];

if (alertResponse == NSAlertSecondButtonReturn) {
Expand Down Expand Up @@ -557,7 +561,11 @@ -(BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
alert.messageText = NSLocalizedString(@"Import subscriptions from OPML file?", nil);
alert.informativeText = NSLocalizedString(@"Do you really want to import the subscriptions from the specified OPML file?", nil);
[alert addButtonWithTitle:NSLocalizedString(@"Import", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a button on an alert")];
NSModalResponse alertResponse = [alert runModal];

if (alertResponse == NSAlertFirstButtonReturn) {
Expand Down Expand Up @@ -1395,7 +1403,11 @@ -(IBAction)emptyTrash:(id)sender
alert.messageText = NSLocalizedString(@"Are you sure you want to delete the messages in the Trash folder permanently?", nil);
alert.informativeText = NSLocalizedString(@"You cannot undo this action", nil);
[alert addButtonWithTitle:NSLocalizedString(@"Empty", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a button on an alert")];
[alert beginSheetModalForWindow:self.mainWindow completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
[self clearUndoStack];
Expand Down Expand Up @@ -1501,7 +1513,11 @@ -(void)showAppInStatusBar
action:@selector(markAllSubscriptionsRead:)
keyEquivalent:@""];
[statusBarMenu addItem:[NSMenuItem separatorItem]];
[statusBarMenu addItemWithTitle:NSLocalizedString(@"Quit Vienna", @"Title of a menu item")
[statusBarMenu addItemWithTitle:NSLocalizedStringWithDefaultValue(@"quitVienna.menuItem",
nil,
NSBundle.mainBundle,
@"Quit Vienna",
@"Title of a menu item")
action:@selector(terminate:)
keyEquivalent:@""];
appStatusItem.menu = statusBarMenu;
Expand Down Expand Up @@ -2203,8 +2219,16 @@ -(IBAction)deleteMessage:(id)sender
NSAlert *alert = [NSAlert new];
alert.messageText = NSLocalizedString(@"Are you sure you want to permanently delete the selected articles?", nil);
alert.informativeText = NSLocalizedString(@"This operation cannot be undone.", nil);
[alert addButtonWithTitle:NSLocalizedString(@"Delete", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"delete.button",
nil,
NSBundle.mainBundle,
@"Delete",
@"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a button on an alert")];
[alert beginSheetModalForWindow:self.mainWindow completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
NSArray *articleArray = self.articleController.markedArticleRange;
Expand Down Expand Up @@ -2406,8 +2430,16 @@ -(IBAction)deleteFolder:(id)sender
NSAlert *alert = [NSAlert new];
alert.messageText = alertTitle;
alert.informativeText = alertBody;
[alert addButtonWithTitle:NSLocalizedString(@"Delete", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"delete.button",
nil,
NSBundle.mainBundle,
@"Delete",
@"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a button on an alert")];
NSModalResponse alertResponse = [alert runModal];

if (alertResponse == NSAlertSecondButtonReturn) {
Expand Down Expand Up @@ -3217,7 +3249,11 @@ -(BOOL)validateMenuItem:(NSMenuItem *)menuItem
} else if (theAction == @selector(deleteFolder:)) {
Folder * folder = [db folderFromID:self.foldersTree.actualSelection];
if (folder.type == VNAFolderTypeSearch) {
[menuItem setTitle:NSLocalizedString(@"Delete", @"Title of a menu item")];
menuItem.title = NSLocalizedStringWithDefaultValue(@"delete.menuItem",
nil,
NSBundle.mainBundle,
@"Delete",
@"Title of a menu item");
} else {
[menuItem setTitle:NSLocalizedString(@"Delete…", @"Title of a menu item")];
}
Expand Down
18 changes: 15 additions & 3 deletions Vienna/Sources/Database/Database.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ - (BOOL)initialiseDatabase {
@"Vienna may not work as expected if the database is corrupted. We recommend you quit Vienna and either restore the database (%@) from a backup or attempt a sqlite3 recovery.",
@"Informative text of an alert"),
self.databaseQueue.path.lastPathComponent];
[alert addButtonWithTitle:NSLocalizedString(@"Quit Vienna", @"Button to quit Vienna after a database check")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"quitVienna.button",
nil,
NSBundle.mainBundle,
@"Quit Vienna",
@"Button to quit Vienna after a database check")];
[alert addButtonWithTitle:NSLocalizedString(@"Continue Anyway",
@"Button to continue running Vienna despite an unsuccessful check")];
NSInteger modalReturn = [alert runModal];
Expand All @@ -160,7 +164,11 @@ - (BOOL)initialiseDatabase {
[alert setMessageText:NSLocalizedString(@"Database Upgrade", nil)];
[alert setInformativeText:NSLocalizedString(@"Vienna must upgrade its database to the latest version. This may take a minute or so. We apologize for the inconvenience.", nil)];
[alert addButtonWithTitle:NSLocalizedString(@"Upgrade Database", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Quit Vienna", @"Button to quit Vienna after a database check")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"quitVienna.button",
nil,
NSBundle.mainBundle,
@"Quit Vienna",
@"Button to quit Vienna after a database check")];
NSInteger modalReturn = [alert runModal];
if (modalReturn == NSAlertSecondButtonReturn) {
return NO;
Expand Down Expand Up @@ -376,7 +384,11 @@ -(NSString *)relocateLockedDatabase:(NSString *)path
alert.messageText = NSLocalizedString(@"Cannot create the Vienna database", nil);
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"A new Vienna database cannot be created at \"%@\" because the folder is probably located on a remote network share and this version of Vienna cannot manage remote databases. Please choose an alternative folder that is located on your local machine.", nil), path];
[alert addButtonWithTitle:NSLocalizedString(@"Locate…", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Title of a button on an alert")];
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a button on an alert")];
NSModalResponse alertResponse = [alert runModal];

// When the cancel button is pressed.
Expand Down
8 changes: 7 additions & 1 deletion Vienna/Sources/Download window/DownloadWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ -(void)windowDidLoad
[downloadMenu addItemWithTitle:NSLocalizedString(@"Remove From List", @"Title of a popup menu item") action:@selector(removeFromList:) keyEquivalent:@""];

// Cancel
[downloadMenu addItemWithTitle:NSLocalizedString(@"Cancel", @"Title of a popup menu item") action:@selector(cancelDownload:) keyEquivalent:@""];
[downloadMenu addItemWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.menuItem",
nil,
NSBundle.mainBundle,
@"Cancel",
@"Title of a menu item")
action:@selector(cancelDownload:)
keyEquivalent:@""];

[downloadMenu setDelegate:self];
table.menu = downloadMenu;
Expand Down
2 changes: 1 addition & 1 deletion Vienna/Sources/Download window/NSWorkspace+OpenWithMenu.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (NSMenu *)vna_openWithMenuForFile:(NSString *)path target:(id)t action:(SEL)s
[submenu addItem:[NSMenuItem separatorItem]];
}

NSString *title = NSLocalizedString(@"Select…", @"Title of a popup menu item");
NSString *title = NSLocalizedString(@"Select…", @"Title of a menu item");
NSMenuItem *selectItem = [submenu addItemWithTitle:title action:selector keyEquivalent:@""];
[selectItem setTag:1];
[selectItem setTarget:target];
Expand Down
12 changes: 10 additions & 2 deletions Vienna/Sources/Main window/ArticleController.m
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,11 @@ -(void)markDeletedByArray:(NSArray *)articleArray deleteFlag:(BOOL)deleteFlag
NSUndoManager * undoManager = NSApp.mainWindow.undoManager;
SEL markDeletedUndoAction = deleteFlag ? @selector(markDeletedUndo:) : @selector(markUndeletedUndo:);
[undoManager registerUndoWithTarget:self selector:markDeletedUndoAction object:articleArray];
[undoManager setActionName:NSLocalizedString(@"Delete", nil)];
[undoManager setActionName:NSLocalizedStringWithDefaultValue(@"delete.undoAction",
nil,
NSBundle.mainBundle,
@"Delete",
@"Name of an undo/redo action in the menu bar's Edit menu.")];

// We will make a new copy of currentArrayOfArticles and folderArrayOfArticles with the selected articles removed.
NSMutableArray * currentArrayCopy = [NSMutableArray arrayWithArray:currentArrayOfArticles];
Expand Down Expand Up @@ -782,7 +786,11 @@ -(void)markReadByArray:(NSArray *)articleArray readFlag:(BOOL)readFlag
NSUndoManager * undoManager = NSApp.mainWindow.undoManager;
SEL markReadUndoAction = readFlag ? @selector(markUnreadUndo:) : @selector(markReadUndo:);
[undoManager registerUndoWithTarget:self selector:markReadUndoAction object:articleArray];
[undoManager setActionName:NSLocalizedString(@"Mark Read", nil)];
[undoManager setActionName:NSLocalizedStringWithDefaultValue(@"markRead.undoAction",
nil,
NSBundle.mainBundle,
@"Mark Read",
@"Name of an undo/redo action in the menu bar's Edit menu.")];

[self innerMarkReadByArray:articleArray readFlag:readFlag];

Expand Down
6 changes: 5 additions & 1 deletion Vienna/Sources/Main window/ArticleListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ -(void)initTableView

NSMenu *articleListMenu = [[NSMenu alloc] init];

[articleListMenu addItemWithTitle:NSLocalizedString(@"Mark Read", @"Title of a menu item")
[articleListMenu addItemWithTitle:NSLocalizedStringWithDefaultValue(@"markRead.menuItem",
nil,
NSBundle.mainBundle,
@"Mark Read",
@"Title of a menu item")
action:@selector(markRead:)
keyEquivalent:@""];
[articleListMenu addItemWithTitle:NSLocalizedString(@"Mark Unread", @"Title of a menu item")
Expand Down
25 changes: 20 additions & 5 deletions Vienna/Sources/Main window/MainWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,18 @@ extension MainWindowController: NSToolbarDelegate {
toolbarSearchField = item.view as? NSSearchField
}

item.label = NSLocalizedString("Search", comment: "Toolbar item label")
item.paletteLabel = NSLocalizedString("Search", comment: "Toolbar item palette label")
item.toolTip = NSLocalizedString("Search", comment: "Toolbar item tooltip")
item.label = NSLocalizedString(
"search.toolbarItem.label",
value: "Search",
comment: "Toolbar item label")
item.paletteLabel = NSLocalizedString(
"search.toolbarItem.paletteLabel",
value: "Search",
comment: "Toolbar item palette label")
item.toolTip = NSLocalizedString(
"search.toolbarItem.toolTip",
value: "Search",
comment: "Toolbar item tooltip")

item.action = #selector(AppController.searchUsingToolbarTextField(_:))
item.menuFormRepresentation = NSMenuItem(title: item.label, action: item.action, keyEquivalent: "")
Expand All @@ -382,8 +391,14 @@ extension MainWindowController: NSToolbarDelegate {
return nil
}
let item = toolbarItem(forSharingService: service, identifier: .email)
item.label = NSLocalizedString("Email Link", comment: "Toolbar item label")
item.paletteLabel = NSLocalizedString("Email Link", comment: "Toolbar item palette label")
item.label = NSLocalizedString(
"emailLink.toolbarItem.label",
value: "Email Link",
comment: "Toolbar item label")
item.paletteLabel = NSLocalizedString(
"emailLink.toolbarItem.paletteLabel",
value: "Email Link",
comment: "Toolbar item palette label")
item.toolTip = NSLocalizedString(
"Email a link to the current article or website",
comment: "Toolbar item tooltip")
Expand Down
6 changes: 5 additions & 1 deletion Vienna/Sources/Main window/UnifiedDisplayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ -(void)initTableView

NSMenu * articleListMenu = [[NSMenu alloc] init];

[articleListMenu addItemWithTitle:NSLocalizedString(@"Mark Read", @"Title of a menu item")
[articleListMenu addItemWithTitle:NSLocalizedStringWithDefaultValue(@"markRead.menuItem",
nil,
NSBundle.mainBundle,
@"Mark Read",
@"Title of a menu item")
action:@selector(markRead:)
keyEquivalent:@""];
[articleListMenu addItemWithTitle:NSLocalizedString(@"Mark Unread", @"Title of a menu item")
Expand Down