21
21
#include " content/nw/src/browser/standard_menus_mac.h"
22
22
23
23
#include " base/strings/sys_string_conversions.h"
24
+ #include " base/strings/utf_string_conversions.h"
25
+ #include " grit/nw_resources.h"
26
+ #include " ui/base/l10n/l10n_util.h"
27
+ #include " ui/base/l10n/l10n_util_mac.h"
28
+
24
29
#import < Cocoa/Cocoa.h>
25
30
26
31
// For some reaon, Apple removed setAppleMenu from the headers in 10.4,
@@ -42,30 +47,30 @@ - (void)setAppleMenu:(NSMenu *)menu;
42
47
void StandardMenusMac::BuildAppleMenu () {
43
48
NSMenu * appleMenu = [[NSMenu alloc ] initWithTitle: @" " ];
44
49
45
- NSString * name = base::SysUTF8ToNSString (app_name_);
46
- [appleMenu addItemWithTitle: [ @" About " stringByAppendingString: name]
50
+ string16 name = base::UTF8ToUTF16 (app_name_);
51
+ [appleMenu addItemWithTitle: l10n_util: : GetNSStringFWithFixup (IDS_ABOUT_MAC, name)
47
52
action: @selector (orderFrontStandardAboutPanel: )
48
53
keyEquivalent: @" " ];
49
54
50
55
[appleMenu addItem: [NSMenuItem separatorItem ]];
51
56
52
- [appleMenu addItemWithTitle: [ @" Hide " stringByAppendingString: name]
57
+ [appleMenu addItemWithTitle: l10n_util: : GetNSStringFWithFixup (IDS_HIDE_APP_MAC, name)
53
58
action: @selector (hide: )
54
59
keyEquivalent: @" h" ];
55
60
56
61
NSMenuItem * menuItem = (NSMenuItem *)[appleMenu
57
- addItemWithTitle: @" Hide Others "
62
+ addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_HIDE_OTHERS_MAC)
58
63
action: @selector (hideOtherApplications: )
59
64
keyEquivalent: @" h" ];
60
65
[menuItem setKeyEquivalentModifierMask: (NSAlternateKeyMask |NSCommandKeyMask )];
61
66
62
- [appleMenu addItemWithTitle: @" Show All "
67
+ [appleMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_SHOW_ALL_MAC)
63
68
action: @selector (unhideAllApplications: )
64
69
keyEquivalent: @" " ];
65
70
66
71
[appleMenu addItem: [NSMenuItem separatorItem ]];
67
72
68
- [appleMenu addItemWithTitle: [ @" Quit " stringByAppendingString: name]
73
+ [appleMenu addItemWithTitle: l10n_util: : GetNSStringFWithFixup (IDS_EXIT_MAC, name)
69
74
action: @selector (closeAllWindows: )
70
75
keyEquivalent: @" q" ];
71
76
@@ -77,36 +82,36 @@ - (void)setAppleMenu:(NSMenu *)menu;
77
82
}
78
83
79
84
void StandardMenusMac::BuildEditMenu () {
80
- NSMenu * editMenu = [[NSMenu alloc ] initWithTitle: @" Edit " ];
85
+ NSMenu * editMenu = [[NSMenu alloc ] initWithTitle: l10n_util: : GetNSStringWithFixup (IDS_EDIT_MENU_MAC) ];
81
86
82
- [editMenu addItemWithTitle: @" Undo "
87
+ [editMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_EDIT_UNDO_MAC)
83
88
action: @selector (undo: )
84
89
keyEquivalent: @" z" ];
85
90
NSMenuItem * menuItem = (NSMenuItem *)[editMenu
86
- addItemWithTitle: @" Redo "
91
+ addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_EDIT_REDO_MAC)
87
92
action: @selector (redo: )
88
93
keyEquivalent: @" z" ];
89
94
[menuItem setKeyEquivalentModifierMask: (NSShiftKeyMask |NSCommandKeyMask )];
90
95
91
96
[editMenu addItem: [NSMenuItem separatorItem ]];
92
97
93
- [editMenu addItemWithTitle: @" Cut "
98
+ [editMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_CUT_MAC)
94
99
action: @selector (cut: )
95
100
keyEquivalent: @" x" ];
96
- [editMenu addItemWithTitle: @" Copy "
101
+ [editMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_COPY_MAC)
97
102
action: @selector (copy: )
98
103
keyEquivalent: @" c" ];
99
- [editMenu addItemWithTitle: @" Paste "
104
+ [editMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_PASTE_MAC)
100
105
action: @selector (paste: )
101
106
keyEquivalent: @" v" ];
102
- [editMenu addItemWithTitle: @" Delete "
107
+ [editMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_EDIT_DELETE_MAC)
103
108
action: @selector (delete: )
104
109
keyEquivalent: @" " ];
105
- [editMenu addItemWithTitle: @" Select All "
110
+ [editMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_EDIT_SELECT_ALL_MAC)
106
111
action: @selector (selectAll: )
107
112
keyEquivalent: @" a" ];
108
113
109
- menuItem = [[NSMenuItem alloc ] initWithTitle: @" Edit "
114
+ menuItem = [[NSMenuItem alloc ] initWithTitle: l10n_util: : GetNSStringWithFixup (IDS_EDIT_MENU_MAC)
110
115
action: nil
111
116
keyEquivalent: @" " ];
112
117
[menuItem setSubmenu: editMenu];
@@ -117,23 +122,24 @@ - (void)setAppleMenu:(NSMenu *)menu;
117
122
}
118
123
119
124
void StandardMenusMac::BuildWindowMenu () {
120
- NSMenu * windowMenu = [[NSMenu alloc ] initWithTitle: @" Window " ];
125
+ NSMenu * windowMenu = [[NSMenu alloc ] initWithTitle: l10n_util: : GetNSStringWithFixup (IDS_WINDOW_MENU_MAC) ];
121
126
122
- [windowMenu addItemWithTitle: @" Minimize "
127
+ [windowMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_MINIMIZE_WINDOW_MAC)
123
128
action: @selector (performMiniaturize: )
124
129
keyEquivalent: @" m" ];
125
- [windowMenu addItemWithTitle: @" Close"
130
+
131
+ [windowMenu addItemWithTitle: l10n_util: :GetNSStringWithFixup (IDS_CLOSE_WINDOW_MAC)
126
132
action: @selector (performClose: )
127
133
keyEquivalent: @" w" ];
128
134
129
135
[windowMenu addItem: [NSMenuItem separatorItem ]];
130
136
131
- [windowMenu addItemWithTitle: @" Bring All to Front "
137
+ [windowMenu addItemWithTitle: l10n_util: : GetNSStringWithFixup (IDS_ALL_WINDOWS_FRONT_MAC)
132
138
action: @selector (arrangeInFront: )
133
139
keyEquivalent: @" " ];
134
140
135
141
NSMenuItem * windowMenuItem = [[NSMenuItem alloc ]
136
- initWithTitle: @" Window "
142
+ initWithTitle: l10n_util: : GetNSStringWithFixup (IDS_WINDOW_MENU_MAC)
137
143
action: nil
138
144
keyEquivalent: @" " ];
139
145
[windowMenuItem setSubmenu: windowMenu];
0 commit comments