Page 1 of 1
Localisation problem for system menu / Ide / gadgets ?
Posted: Sat Sep 07, 2024 12:49 pm
by flashbob
I tested on different MACs with PB 5.73, 6.04, 6.10
The system language is german, but only in PB IDE the System Menu (About PureBasic, Preferences, Hide ...) appears in english.
Same behaviour if you right click on toolbar of PB IDE or on StringGadget, WebGadget, Debug window,... in compiled program. All Popup Items are in english. Tabs in the IDE, on the other hand, are correctly in German...
All other programs work perfectly. The behavior described only occurs under PB IDE and compiled programs.
Re: Localisation problem for system menu / Ide / gadgets ?
Posted: Sun Sep 08, 2024 9:19 am
by mk-soft
No Bug ...
You have to adjust the menu text yourself.
Please ask first before you report it as a bug.
Code: Select all
;-TOP
#ProgramTitle = "Main Window"
#ProgramVersion = "v1.01.2"
Enumeration Windows
#Main
EndEnumeration
Enumeration MenuBar
#MainMenu
EndEnumeration
Enumeration MenuItems
#MainMenuAbout
#MainMenuExit
EndEnumeration
Enumeration Gadgets
EndEnumeration
Enumeration StatusBar
#MainStatusBar
EndEnumeration
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
; Resize gadgets
EndProcedure
Procedure Main()
Protected dx, dy
#MainStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 800, 600, #ProgramTitle , #MainStyle)
; Menu
CreateMenu(#MainMenu, WindowID(#Main))
MenuTitle("&File")
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
MenuItem(#PB_Menu_About, "") ; Activate Menu
SetMenuItemText(#MainMenu, #PB_Menu_About, "Über " + GetFilePart(ProgramFilename()))
MenuItem(#PB_Menu_Preferences, "") ; Activate Menu
SetMenuItemText(#MainMenu, #PB_Menu_Preferences, "Einstellungen"+#TAB$+"CMD+,")
SetMenuItemText(#MainMenu, #PB_Menu_Quit, "Beenden"+#TAB$+"CMD+Q")
CompilerElse
MenuItem(#MainMenuAbout, "About")
CompilerEndIf
; Menu File Items
CompilerIf Not #PB_Compiler_OS = #PB_OS_MacOS
MenuBar()
MenuItem(#MainMenuExit, "E&xit")
CompilerEndIf
; StatusBar
CreateStatusBar(#MainStatusBar, WindowID(#Main))
AddStatusBarField(#PB_Ignore)
; Gadgets
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Main)
; Event Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Main
Break
EndSelect
Case #PB_Event_Menu
Select EventMenu()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
Case #PB_Menu_About
PostEvent(#PB_Event_Menu, #Main, #MainMenuAbout)
Case #PB_Menu_Preferences
MessageRequester("Info", "Menu Preferences")
Case #PB_Menu_Quit
PostEvent(#PB_Event_CloseWindow, #Main, #Null)
CompilerEndIf
Case #MainMenuAbout
MessageRequester("About", #ProgramTitle + #LF$ + #ProgramVersion, #PB_MessageRequester_Info)
Case #MainMenuExit
PostEvent(#PB_Event_CloseWindow, #Main, #Null)
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()
Re: Localisation problem for system menu / Ide / gadgets ?
Posted: Sun Sep 08, 2024 10:40 am
by flashbob
... please read entire text...
Regarding the menu, it's not just about the three menu items that I can change. All others remain in English (Hide, Show All, Services, ...)
To avoid this I need Cocoa (see
viewtopic.php?p=460298#p460298)
The problem has been known on Mac for almost 10 years (see link). Because it wasn't implemented correctly in PB, the only way seems to be the described solution using Cocoa Api.
So this is a system menu that has not been localized, otherwise I would not have posted this case here...
In your opinion, are the other points regarding localization not a bug but rather a feature ?