Merge pull request #17340 from hrydgard/mac-translation-work

Mac translation work
This commit is contained in:
Henrik Rydgård 2023-04-27 14:03:46 +02:00 committed by GitHub
commit 4d4881fcde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 32 deletions

View File

@ -331,8 +331,15 @@ static int DefaultGPUBackend() {
return (int)GPUBackend::VULKAN;
}
#endif
#elif PPSSPP_PLATFORM(MAC)
#if PPSSPP_ARCH(ARM64)
return (int)GPUBackend::VULKAN;
#else
// On Intel (generally older Macs) default to OpenGL.
return (int)GPUBackend::OPENGL;
#endif
#endif
// TODO: On some additional Linux platforms, we should also default to Vulkan.
return (int)GPUBackend::OPENGL;
}

View File

@ -42,8 +42,6 @@ variableName.state = [self controlStateForBool: ConfigurationValueName];
+(instancetype)sharedInstance;
-(void)setupAppBarItems;
@property (assign) NSMenu *fileMenu;
@property (assign) std::shared_ptr<I18NCategory> mainSettingsLocalization;
@property (assign) std::shared_ptr<I18NCategory> graphicsLocalization;
@end
void initializeOSXExtras() {
@ -57,12 +55,19 @@ void initializeOSXExtras() {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
stub = [BarItemsManager new];
stub.mainSettingsLocalization = GetI18NCategory(I18NCat::MAINSETTINGS);
});
return stub;
}
-(NSString *)localizedString: (const char *)key category: (I18NCat)cat {
return @(T(cat, key));
}
-(NSString *)localizedMenuString: (const char *)key {
std::string processed = UnescapeMenuString(T(I18NCat::DESKTOPUI, key), nullptr);
return @(processed.c_str());
}
-(void)setupAppBarItems {
NSMenuItem *fileMenuItem = [[NSMenuItem alloc] init];
@ -85,7 +90,7 @@ void initializeOSXExtras() {
[NSApplication.sharedApplication.menu addItem:debugMenuItem];
[NSApplication.sharedApplication.menu addItem:helpMenuItem];
NSString *windowMenuItemTitle = @"Window";
NSString *windowMenuItemTitle = @"Window"; // Don't translate, we lookup this.
// Rearrange 'Window' to be behind 'Help'
for (NSMenuItem *item in NSApplication.sharedApplication.menu.itemArray) {
if ([item.title isEqualToString:windowMenuItemTitle]) {
@ -138,7 +143,7 @@ void initializeOSXExtras() {
}
- (void)menuNeedsUpdate:(NSMenu *)menu {
if ([menu.title isEqualToString: [self localizedString:"Graphics" category: self.mainSettingsLocalization]]) {
if ([menu.title isEqualToString: [self localizedMenuString:"Graphics"]]) {
for (NSMenuItem *item in menu.itemArray) {
switch (item.tag) {
case 1:
@ -166,7 +171,7 @@ void initializeOSXExtras() {
break;
}
}
} else if ([menu.title isEqualToString: [self localizedString:"Debug" category: self.mainSettingsLocalization]]) {
} else if ([menu.title isEqualToString: [self localizedMenuString:"Debug"]]) {
for (NSMenuItem *item in menu.itemArray) {
switch ([item tag]) {
case 2:
@ -182,10 +187,6 @@ void initializeOSXExtras() {
}
}
-(NSString *)localizedString: (const char *)key category: (std::shared_ptr<I18NCategory>)cat {
return @(self.mainSettingsLocalization->T(key));
}
-(NSMenu *)makeHelpMenu {
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"Help"];
NSMenuItem *githubItem = [[NSMenuItem alloc] initWithTitle:@"Report an issue" action:@selector(reportAnIssue) keyEquivalent:@""];
@ -207,8 +208,11 @@ void initializeOSXExtras() {
}
-(NSMenu *)makeFileSubmenu {
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"File"];
NSMenuItem *openWithSystemFolderBrowserItem = [[NSMenuItem alloc] initWithTitle:@"Open..." action:@selector(openSystemFileBrowser) keyEquivalent:@"o"];
std::shared_ptr<I18NCategory> desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI);
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
NSMenu *menu = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("File")];
NSMenuItem *openWithSystemFolderBrowserItem = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load") action:@selector(openSystemFileBrowser) keyEquivalent:@"o"];
openWithSystemFolderBrowserItem.keyEquivalentModifierMask = NSEventModifierFlagCommand;
openWithSystemFolderBrowserItem.enabled = YES;
openWithSystemFolderBrowserItem.target = self;
@ -218,21 +222,24 @@ void initializeOSXExtras() {
[self.fileMenu addItem:[NSMenuItem separatorItem]];
NSMenuItem *openMemstickFolderItem = [[NSMenuItem alloc] initWithTitle:@"Open Memory Stick" action:@selector(openMemstickFolder) keyEquivalent:@""];
NSMenuItem *openMemstickFolderItem = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Open Memory Stick") action:@selector(openMemstickFolder) keyEquivalent:@""];
openMemstickFolderItem.target = self;
[self.fileMenu addItem:openMemstickFolderItem];
return menu;
}
-(NSMenu *)makeGraphicsMenu {
NSMenu *parent = [[NSMenu alloc] initWithTitle:@(self.mainSettingsLocalization->T("Graphics"))];
-(NSMenu *)makeGraphicsMenu {
std::shared_ptr<I18NCategory> mainSettingsLocalization = GetI18NCategory(I18NCat::MAINSETTINGS);
std::shared_ptr<I18NCategory> graphicsLocalization = GetI18NCategory(I18NCat::GRAPHICS);
std::shared_ptr<I18NCategory> desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI);
NSMenu *parent = [[NSMenu alloc] initWithTitle:@(mainSettingsLocalization->T("Graphics"))];
NSMenu *backendsMenu = [[NSMenu alloc] init];
#define GRAPHICS_LOCALIZED(key) @(graphicsLocalization->T(key))
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
self.graphicsLocalization = GetI18NCategory(I18NCat::GRAPHICS);
#define GRAPHICS_LOCALIZED(key) @(self.graphicsLocalization->T(key))
NSMenuItem *gpuBackendItem = [[NSMenuItem alloc] initWithTitle:GRAPHICS_LOCALIZED("Backend") action:nil keyEquivalent:@""];
NSMenuItem *gpuBackendItem = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Backend") action:nil keyEquivalent:@""];
std::vector<GPUBackend> allowed = [self allowedGPUBackends];
for (int i = 0; i < allowed.size(); i++) {
@ -254,7 +261,7 @@ void initializeOSXExtras() {
MENU_ITEM(vsyncItem, GRAPHICS_LOCALIZED("VSync"), @selector(toggleVSync:), g_Config.bVSync, 2)
[parent addItem:vsyncItem];
MENU_ITEM(fullScreenItem, GRAPHICS_LOCALIZED("Fullscreen"), @selector(toggleFullScreen:), g_Config.bFullScreen, 3)
MENU_ITEM(fullScreenItem, DESKTOPUI_LOCALIZED("Fullscreen"), @selector(toggleFullScreen:), g_Config.bFullScreen, 3)
[parent addItem:fullScreenItem];
[parent addItem:[NSMenuItem separatorItem]];
@ -264,7 +271,7 @@ void initializeOSXExtras() {
[parent addItem:[NSMenuItem separatorItem]];
MENU_ITEM(fpsCounterItem, GRAPHICS_LOCALIZED("Show FPS Counter"), @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER, 5)
MENU_ITEM(fpsCounterItem, DESKTOPUI_LOCALIZED("Show FPS Counter"), @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER, 5)
fpsCounterItem.tag = (int)ShowStatusFlags::FPS_COUNTER + 100;
MENU_ITEM(speedCounterItem, GRAPHICS_LOCALIZED("Show Speed"), @selector(setToggleShowCounterItem:), g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER, 6)
@ -286,8 +293,8 @@ void initializeOSXExtras() {
std::shared_ptr<I18NCategory> sysInfoLocalization = GetI18NCategory(I18NCat::SYSINFO);
std::shared_ptr<I18NCategory> desktopUILocalization = GetI18NCategory(I18NCat::DESKTOPUI);
#define DESKTOPUI_LOCALIZED(key) @(UnescapeMenuString(desktopUILocalization->T(key), nil).c_str())
NSMenu *parent = [[NSMenu alloc] initWithTitle:@(sysInfoLocalization->T("Debug"))];
NSMenu *parent = [[NSMenu alloc] initWithTitle:DESKTOPUI_LOCALIZED("Debugging")];
NSMenuItem *breakAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Break") action:@selector(breakAction:) keyEquivalent:@""];
breakAction.tag = 1;
@ -303,10 +310,10 @@ void initializeOSXExtras() {
[parent addItem:ignoreIllegalRWAction];
[parent addItem:[NSMenuItem separatorItem]];
NSMenuItem *loadSymbolMapAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load Map file") action:@selector(loadMapFile) keyEquivalent:@""];
NSMenuItem *loadSymbolMapAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load Map File...") action:@selector(loadMapFile) keyEquivalent:@""];
loadSymbolMapAction.target = self;
NSMenuItem *saveMapFileAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Save Map file") action:@selector(saveMapFile) keyEquivalent:@""];
NSMenuItem *saveMapFileAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Save Map file...") action:@selector(saveMapFile) keyEquivalent:@""];
saveMapFileAction.target = self;
NSMenuItem *loadSymFileAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Load .sym File...") action:@selector(loadSymbolsFile) keyEquivalent:@""];
@ -321,7 +328,7 @@ void initializeOSXExtras() {
NSMenuItem *takeScreenshotAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Take Screenshot") action:@selector(takeScreenshot) keyEquivalent:@""];
takeScreenshotAction.target = self;
NSMenuItem *dumpNextFrameToLogAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Dump next frame to log") action:@selector(dumpNextFrameToLog) keyEquivalent:@""];
NSMenuItem *dumpNextFrameToLogAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Dump Next Frame to Log") action:@selector(dumpNextFrameToLog) keyEquivalent:@""];
dumpNextFrameToLogAction.target = self;
NSMenuItem *copyBaseAddr = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Copy PSP memory base address") action:@selector(copyAddr) keyEquivalent:@""];
@ -497,7 +504,7 @@ TOGGLE_METHOD(ShowDebugStats, g_Config.bShowDebugStats, NativeMessageReceived("c
-(void)addOpenRecentlyItem {
std::vector<std::string> recentIsos = g_Config.RecentIsos();
NSMenuItem *openRecent = [[NSMenuItem alloc] initWithTitle:@"Open Recent" action:nil keyEquivalent:@""];
NSMenuItem *openRecent = [[NSMenuItem alloc] initWithTitle:@"Recent" action:nil keyEquivalent:@""];
NSMenu *recentsMenu = [[NSMenu alloc] init];
if (recentIsos.empty())
openRecent.enabled = NO;

View File

@ -203,6 +203,7 @@ Pause When Not Focused = &Pause when not focused
Portrait = Portrait
Portrait reversed = Portrait reversed
PPSSPP Forums = PPSSPP &forums
Recent = &Recent
Record = &Record
Record Audio = Record &audio
Record Display = Record &display

View File

@ -124,7 +124,7 @@ Break = Bryt
Break on Load = Stoppa direkt efter laddning
Buy Gold = Buy Gold
Control Mapping... = Kontrollmappning...
Copy PSP memory base address = Copy PSP memory base &address
Copy PSP memory base address = Kopiera bas-addressen till PSP'n minne
Debugging = Debuggning
Deposterize = Deposterize
Direct3D9 = Direct3D9
@ -520,8 +520,8 @@ Must Restart = Starta om PPSSPP för att ändringen ska få effekt.
Native device resolution = Native device resolution
Nearest = Närmast
No buffer = Ingen buffer
Show Battery % = Show Battery %
Show Speed = Show Speed
Show Battery % = Visa batteri-%
Show Speed = Visa hastighet
Skip Buffer Effects = Skippa buffereffekter (snabbare, risk för fel)
None = Inget
Number of Frames = Antal frames