I have most of my Apps localised in 5 languages which responds to the language in the system settings.
If the user wants the app to run in one of the other languages different to the system language how do I set for example System = English, App = French ?
Hi Beatrix,
That bit works fine when the user changes the language in the system settings. If that part is set to German but they would like to use it in a classroom perhaps in a French class and don’t want to change the system settings is there a way to make my app only appear with the French menus and printouts and access the other labels in the Localised Strings?
sub ChangeLanguageTo(strLanguageCode as string)
dim thestring as string
dim s as new shell
if targetwin32 then
msgbox "Mac only"
else
thestring = "defaults write **com.mysite.myapp** AppleLanguages '(""XX"")' "
thestring = replace(thestring,"XX",strLanguageCode)
s.Execute thestring
Msgbox "The app needs to shut down to make this change"
quit
end if
end sub
Did you have a look at the lower part of my screenshot? You can change the language of each app. If you want mixed localisations then you are on your own.
I think it would take a total redesign of your app with YOU taking care of the localization. Like reading Locale.Current at start up and saving it into user defined one as App.MyCurrentLocale
And all the time, using it to get the constant values for your user locale settings.
It will make #dynamicConstValues useless
You should handle those too.
Changing the localization would be changing App.MyCurrentLocale
I think you’re fighting against the built-in MacOS feature. As Beatrix showed, there is already a way to change an app’s language, which takes care of everything for you (even system menus, like inside the menu are localised). That’s definitively the preferred way.
Apple introduced the ability to set an app language via system settings with macOS 12 (or 11?).
Before, you had to use a terminal or execute a shell script to go via „defaults write“ to change the language of an app. There is a way to permanently change the language, another does change it only for the next time, you use the app.
What if we are keeping the App language the same as the system but just want the Print Routines to access the Localised Strings of a different language, is that possible?
Var word As String = kMyConstantWord("pt") // Get the Portuguese version of kMyConstantWord
word = kMyConstantWord("en_AU") // Australian English
word = kMyConstantWord(language_code) // whatever valid code