summaryrefslogtreecommitdiff
path: root/cocoa
diff options
context:
space:
mode:
authorSven Weidauer <sven.weidauer@gmail.com>2011-02-25 16:20:10 +0000
committerSven Weidauer <sven.weidauer@gmail.com>2011-02-25 16:20:10 +0000
commit2bb6987d39ad1bb199b3e990cc7260a1b3e80160 (patch)
treefa20e3f2467ac71b7639afaef7fb2b7eb2d657b4 /cocoa
parentba20058f2c42c471d0882e78cc6191bd8e11cd11 (diff)
downloadnetsurf-2bb6987d39ad1bb199b3e990cc7260a1b3e80160.tar.gz
netsurf-2bb6987d39ad1bb199b3e990cc7260a1b3e80160.tar.bz2
Prepared for localizing string literals in source code.
svn path=/trunk/netsurf/; revision=11795
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/BrowserView.m33
-rw-r--r--cocoa/BrowserWindowController.m8
-rw-r--r--cocoa/DownloadWindowController.m22
-rw-r--r--cocoa/utils.m6
4 files changed, 46 insertions, 23 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index 00fddb4bd..131499d2c 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -474,13 +474,17 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
if ((box = box = box_object_at_point( browser->current_content, point.x, point.y )) != NULL) {
NSString *imageURL = [NSString stringWithUTF8String: content_get_url( box->object )];
- [[popupMenu addItemWithTitle: @"Open image in new tab" action: @selector(cmOpenURLInTab:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Open image in new tab", @"Context menu" )
+ action: @selector(cmOpenURLInTab:)
keyEquivalent: @""] setRepresentedObject: imageURL];
- [[popupMenu addItemWithTitle: @"Open image in new window" action: @selector(cmOpenURLInWindow:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Open image in new window", @"Context menu" )
+ action: @selector(cmOpenURLInWindow:)
keyEquivalent: @""] setRepresentedObject: imageURL];
- [[popupMenu addItemWithTitle: @"Save image as" action: @selector(cmDownloadURL:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Save image as", @"Context menu" )
+ action: @selector(cmDownloadURL:)
keyEquivalent: @""] setRepresentedObject: imageURL];
- [[popupMenu addItemWithTitle: @"Copy image" action: @selector(cmImageCopy:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Copy image", @"Context menu" )
+ action: @selector(cmImageCopy:)
keyEquivalent: @""] setRepresentedObject: (id)content_get_bitmap( box->object )];
[popupMenu addItem: [NSMenuItem separatorItem]];
@@ -489,21 +493,28 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
if ((box = box_href_at_point( browser->current_content, point.x, point.y )) != NULL) {
NSString *target = [NSString stringWithUTF8String: box->href];
- [[popupMenu addItemWithTitle: @"Open link in new tab" action: @selector(cmOpenURLInTab:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Open link in new tab", @"Context menu" )
+ action: @selector(cmOpenURLInTab:)
keyEquivalent: @""] setRepresentedObject: target];
- [[popupMenu addItemWithTitle: @"Open link in new window" action: @selector(cmOpenURLInWindow:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Open link in new window", @"Context menu" )
+ action: @selector(cmOpenURLInWindow:)
keyEquivalent: @""] setRepresentedObject: target];
- [[popupMenu addItemWithTitle: @"Save link target" action: @selector(cmDownloadURL:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Save link target", @"Context menu" )
+ action: @selector(cmDownloadURL:)
keyEquivalent: @""] setRepresentedObject: target];
- [[popupMenu addItemWithTitle: @"Copy link" action: @selector(cmLinkCopy:)
+ [[popupMenu addItemWithTitle: NSLocalizedString( @"Copy link", @"Context menu" )
+ action: @selector(cmLinkCopy:)
keyEquivalent: @""] setRepresentedObject: target];
[popupMenu addItem: [NSMenuItem separatorItem]];
}
- [popupMenu addItemWithTitle: @"Back" action: @selector(goBack:) keyEquivalent: @""];
- [popupMenu addItemWithTitle: @"Reload" action: @selector(reloadPage:) keyEquivalent: @""];
- [popupMenu addItemWithTitle: @"Forward" action: @selector(goForward:) keyEquivalent: @""];
+ [popupMenu addItemWithTitle: NSLocalizedString( @"Back", @"Context menu" )
+ action: @selector(goBack:) keyEquivalent: @""];
+ [popupMenu addItemWithTitle: NSLocalizedString( @"Reload", @"Context menu" )
+ action: @selector(reloadPage:) keyEquivalent: @""];
+ [popupMenu addItemWithTitle: NSLocalizedString( @"Forward", @"Context menu" )
+ action: @selector(goForward:) keyEquivalent: @""];
[NSMenu popUpContextMenu: popupMenu withEvent: event forView: self];
diff --git a/cocoa/BrowserWindowController.m b/cocoa/BrowserWindowController.m
index 2701fecec..a0c59594a 100644
--- a/cocoa/BrowserWindowController.m
+++ b/cocoa/BrowserWindowController.m
@@ -115,8 +115,12 @@
if ([tabView numberOfTabViewItems] <= 1) return YES;
if ([[NSUserDefaults standardUserDefaults] boolForKey: kAlwaysCloseMultipleTabs]) return YES;
- NSAlert *ask = [NSAlert alertWithMessageText: @"Do you really want to close this window?" defaultButton:@"Yes" alternateButton:@"No" otherButton:nil
- informativeTextWithFormat: @"There are %d tabs open, do you want to close them all?", [tabView numberOfTabViewItems]];
+ NSAlert *ask = [NSAlert alertWithMessageText: NSLocalizedString( @"Do you really want to close this window?", nil )
+ defaultButton: NSLocalizedString( @"Yes", @"'Yes' button" )
+ alternateButton: NSLocalizedString( @"No" , @"'No' button" )
+ otherButton:nil
+ informativeTextWithFormat: NSLocalizedString( @"There are %d tabs open, do you want to close them all?", nil ),
+ [tabView numberOfTabViewItems]];
[ask setShowsSuppressionButton:YES];
[ask beginSheetModalForWindow: window modalDelegate:self didEndSelector:@selector(canCloseAlertDidEnd:returnCode:contextInfo:)
diff --git a/cocoa/DownloadWindowController.m b/cocoa/DownloadWindowController.m
index 6cb50202a..ccf49aa88 100644
--- a/cocoa/DownloadWindowController.m
+++ b/cocoa/DownloadWindowController.m
@@ -140,7 +140,8 @@ static void cocoa_register_download( DownloadWindowController *download );
- (void) showError: (NSString *)error;
{
canClose = NO;
- NSAlert *alert = [NSAlert alertWithMessageText: @"Error" defaultButton: @"OK"
+ NSAlert *alert = [NSAlert alertWithMessageText: NSLocalizedString( @"Error", @"show error" )
+ defaultButton: NSLocalizedString( @"OK", @"'OK' button" )
alternateButton: nil otherButton: nil
informativeTextWithFormat: @"%@", error];
@@ -170,9 +171,12 @@ static void cocoa_register_download( DownloadWindowController *download );
{
if ([[NSUserDefaults standardUserDefaults] boolForKey: kAlwaysCancelDownload]) return YES;
- NSAlert *ask = [NSAlert alertWithMessageText: @"Cancel download?" defaultButton: @"Yes"
- alternateButton: @"No" otherButton: nil
- informativeTextWithFormat: @"Should the download of '%@' really be cancelled?", [self fileName]];
+ NSAlert *ask = [NSAlert alertWithMessageText: NSLocalizedString( @"Cancel download?", @"Download" )
+ defaultButton: NSLocalizedString( @"Yes", @"" )
+ alternateButton: NSLocalizedString( @"No", @"" )
+ otherButton: nil
+ informativeTextWithFormat: NSLocalizedString( @"Should the download of '%@' really be cancelled?", @"Download" ),
+ [self fileName]];
[ask setShowsSuppressionButton: YES];
[ask beginSheetModalForWindow: [self window] modalDelegate: self
didEndSelector: @selector(askCancelDidEnd:returnCode:contextInfo:) contextInfo: NULL];
@@ -242,19 +246,19 @@ static NSString *cocoa_file_size_string( float size )
static NSString *cocoa_time_string( unsigned seconds )
{
- if (seconds <= 10) return @"less than 10 seconds";
+ if (seconds <= 10) return NSLocalizedString( @"less than 10 seconds", @"time remaining" );
- if (seconds < 60) return [NSString stringWithFormat: @"%u seconds", seconds];
+ if (seconds < 60) return [NSString stringWithFormat: NSLocalizedString( @"%u seconds", @"time remaining" ), seconds];
unsigned minutes = seconds / 60;
seconds = seconds % 60;
- if (minutes < 60) return [NSString stringWithFormat: @"%u:%02u minutes", minutes, seconds];
+ if (minutes < 60) return [NSString stringWithFormat: NSLocalizedString( @"%u:%02u minutes", @"time remaining: minutes, seconds" ) , minutes, seconds];
unsigned hours = minutes / 60;
minutes = minutes % 60;
- return [NSString stringWithFormat: @"%2:%02u hours", hours, minutes];
+ return [NSString stringWithFormat: NSLocalizedString( @"%2:%02u hours", @"time remaining: hours, minutes" ), hours, minutes];
}
- (NSString *) statusText;
@@ -275,7 +279,7 @@ static NSString *cocoa_time_string( unsigned seconds )
float timeRemaining = (float)(totalSize - receivedSize) / speed;
timeRemainingString = [NSString stringWithFormat: @": %@", cocoa_time_string( timeRemaining )];
}
- totalSizeString = [NSString stringWithFormat: @" of %@", cocoa_file_size_string( totalSize )];
+ totalSizeString = [NSString stringWithFormat: NSLocalizedString( @" of %@", @"... of (total size)" ), cocoa_file_size_string( totalSize )];
}
return [NSString stringWithFormat: @"%@%@%@%@", cocoa_file_size_string( receivedSize ),
diff --git a/cocoa/utils.m b/cocoa/utils.m
index cd7ce7bfe..cc8b29f81 100644
--- a/cocoa/utils.m
+++ b/cocoa/utils.m
@@ -30,7 +30,11 @@ void die(const char * const error)
void warn_user(const char *warning, const char *detail)
{
- NSRunAlertPanel( @"Warning", @"Warning %s: %s", @"OK", nil, nil, warning, detail );
+ NSRunAlertPanel( NSLocalizedString( @"Warning", @"Warning title" ),
+ NSLocalizedString( @"Warning %s%s%s", @"Warning message" ),
+ NSLocalizedString( @"OK", @"" ), nil, nil,
+ warning, detail != NULL ? ": " : "",
+ detail != NULL ? detail : "" );
}
void PDF_Password(char **owner_pass, char **user_pass, char *path)