summaryrefslogtreecommitdiff
path: root/src/macos.m
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-22 19:27:44 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-22 19:29:09 +0200
commitde34940c4dd709fa7103c6961cbe8b410638ffdd (patch)
tree03afd79839273638bc25efbed0d8e70e2ce0896d /src/macos.m
parent0bd8465b33c6e3f6dacf79785a47cbd6abea6f25 (diff)
Lang: Improvements; macOS menu items
Use char pointer ranges for the array of IDs and strings to avoid allocations. Translate macOS menu items. IssueID #192
Diffstat (limited to 'src/macos.m')
-rw-r--r--src/macos.m4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/macos.m b/src/macos.m
index c6c30fa5..12575dd5 100644
--- a/src/macos.m
+++ b/src/macos.m
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "macos.h" 23#include "macos.h"
24#include "app.h" 24#include "app.h"
25#include "lang.h"
25#include "ui/color.h" 26#include "ui/color.h"
26#include "ui/command.h" 27#include "ui/command.h"
27#include "ui/keys.h" 28#include "ui/keys.h"
@@ -462,6 +463,7 @@ void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *
462 NSApplication *app = [NSApplication sharedApplication]; 463 NSApplication *app = [NSApplication sharedApplication];
463 MyDelegate *myDel = (MyDelegate *) app.delegate; 464 MyDelegate *myDel = (MyDelegate *) app.delegate;
464 NSMenu *appMenu = [app mainMenu]; 465 NSMenu *appMenu = [app mainMenu];
466 menuLabel = translateCStr_Lang(menuLabel);
465 NSMenuItem *mainItem = [appMenu insertItemWithTitle:[NSString stringWithUTF8String:menuLabel] 467 NSMenuItem *mainItem = [appMenu insertItemWithTitle:[NSString stringWithUTF8String:menuLabel]
466 action:nil 468 action:nil
467 keyEquivalent:@"" 469 keyEquivalent:@""
@@ -469,7 +471,7 @@ void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *
469 NSMenu *menu = [[NSMenu alloc] initWithTitle:[NSString stringWithUTF8String:menuLabel]]; 471 NSMenu *menu = [[NSMenu alloc] initWithTitle:[NSString stringWithUTF8String:menuLabel]];
470 [menu setAutoenablesItems:NO]; 472 [menu setAutoenablesItems:NO];
471 for (size_t i = 0; i < count; ++i) { 473 for (size_t i = 0; i < count; ++i) {
472 const char *label = items[i].label; 474 const char *label = translateCStr_Lang(items[i].label);
473 if (label[0] == '\r') { 475 if (label[0] == '\r') {
474 /* Skip the formatting escape. */ 476 /* Skip the formatting escape. */
475 label += 2; 477 label += 2;