I am searching for a way to get localised strings for a special language, which is not the system language. For example the user has the system language set to french but want to see my app in german. Please do not ask for the reason, that is not under my control. The localised constant has french, english and german values with english as default, because that should be for most people correct.
Is there any property which can be set in order to change the apps behaviour?
Is there a way to access the xojo constant values for a special language?
its about as close as you get BUT this will not localize things like menus etc
depending on what OS you’re on the “how to localize those dynamically” will vary
Thanks Norman. That’s what I was looking for. Just the menu thing is not so cool… but can’t I create a menu by code? At least for the contextual menus this should work… for the main menu I can append items via code when opening the window… so tested this now and it works also for the main menu…
there are bits of the menu you cant localize by hand even on macOS
there are a few that get added by the system and they only localize properly if the user switches their operating language
thats why I said “depending on what OS you’re on …”
Oh ok, I think I got it. The first menu of the application is always set by MacOS like services and quit by the system language. I think I can live with that.
And some may be added to the end of the EditMenu IF its text is “Edit”
You can avoid this by making the text in there "Edit "
I have a method that when required loads the needed menus. As Norman said and you found out yourself, Quit and other system-owned strings are not included.
The Undo is hardcoded; it will change elsewhere according to its appropriate text Undo/Redo
The content of the method is like this:
if pLocalized then
FileMenu.Text = kFile(“bn”)
FileClose.text = kClose(“bn”)
fileSave.text = kSave(“bn”)
EditMenu.Text = kEdit(“bn”)
EditUndo.text = “&Undo”
editCut.Text = kCut(“bn”)
EditCopy.text = kCopy(“bn”)
EditPaste.text = kPaste(“bn”)
EditClear.text = kEditClear(“bn”)
EditSelectAll.text = kSelAll(“bn”)
editSpeech.text = kSpeechMenu(“bn”)
StartSpeechMenu.text = kStartSpeech(“bn”)
stopSpeechMenu.text = kStopSpeech(“bn”)
FileMenu.Text = kFile
FileClose.text = kClose
fileSave.text = kSave
EditMenu.Text = kEdit
EditUndo.text = “&Undo”
editCut.Text = kCut
EditCopy.text = kCopy
EditPaste.text = kPaste
EditClear.text = kEditClear
EditSelectAll.text = kSelAll
editSpeech.text = kSpeechMenu
StartSpeechMenu.text = kStartSpeech
stopSpeechMenu.text = kStopSpeech