Page 1 of 1

Localized system dialogs on OS X

Posted: Fri Oct 12, 2012 6:06 am
by wilbert
When compiling with PureBasic for OS X, all system dialogs are english by default.
You can specify in the Info.plist file what languages your application supports.
For each language you add here, the system dialogs will automatically be localized.
Some PureBasic dialogs like MessageRequester seem to be hardcoded in english but OpenFileRequester for example will be localized.

Code: Select all

  <key>CFBundleLocalizations</key>
    <array>
    <string>de</string>
    <string>en</string>
    <string>fr</string>
    <string>nl</string>
    </array>

Re: Localized system dialogs on OS X

Posted: Sun Oct 21, 2012 12:04 pm
by grabiller
Thanks for the tip wilbert.

For my localization system, I use this to detect wich language is used on Mac OSX (also on Linux):

Code: Select all

#LC_ALL = 0
Protected lan$ = PeekS( setlocale_( #LC_ALL, "" ) )
If lan$ = "C"
  ProcedureReturn "en"
Else
  ProcedureReturn Left(lan$,2)
EndIf
This will return 'en', 'de', 'fr', 'nl', etc..

Just to be sure, does this sounds like to be the correct way to you for Mac OSX ?

Re: Localized system dialogs on OS X

Posted: Sun Oct 21, 2012 12:51 pm
by wilbert
I'm not sure what your function should return.
If it should return the language of the OS, it doesn't seem to work properly.
On my computer lan$ = "C" and you return that as "en". The system language however is dutch (nl).
For cocoa, I mentioned it here http://www.purebasic.fr/english/viewtop ... 02#p390802 .

Re: Localized system dialogs on OS X

Posted: Sun Oct 21, 2012 1:19 pm
by grabiller
Thanks wilbert.

That's interesting to know.

On Linux (and normally in standard C) 'setlocale(LC_ALL,"")' sets and returns the current system locale and in my case it properly returns "fr_FR.UTF" from Ubuntu.

I guess it shouldn't always return 'C' on Mac OSX, but anyway, I'll use your method from your ' [PB Cocoa] Methods, Tips & Tricks' thread instead.

Thanks again.