Page 1 of 1

PB4.30 x86 - MacOS X-Defaults

Posted: Mon Feb 02, 2009 12:30 am
by jamirokwai
Dear board,

if you want to read or write default-values from the Mac OS X-core, try this (if you're on X86, and Leopard 10.5.6 it should work, but no guarantee, no refund for data loss):

Code: Select all

Procedure.s Get_MacOSX_Default(inwhat$, whattype$)
 x  = RunProgram("/usr/bin/defaults", "read " + inwhat$ + " " + whattype$, "/usr/bin", #PB_Program_Open|#PB_Program_Read)
 x$ = ""
 While ProgramRunning(x)
  x$ = x$ + Trim(ReadProgramString(x))
 Wend
 CloseProgram(x)
 ProcedureReturn x$
EndProcedure

debug Get_MacOSX_Default("NSGlobalDomain", "AppleLanguages")
debug Get_MacOSX_Default("NSGlobalDomain", "AppleLocale")
This will give back the Languages you set inside the Configuration dialogue and afterwards the current Locale in international
form, for example "de-DE" or "en-GB".

Maybe this information helps you to get the default language of Mac OS X to set the right language inside your applications :)

Good luck in localising...