Language de-CH

Meine Kunden in der deutschspachigen Schweiz haben das Problem, dass meine Apps immer mit englischer Sprache gestartet werden. In Xojo gibt es in R2014R2.1 keine Unterstützung für “Schweiz”.

In OS X 10.9.5 kann man “Schweizer Hochdeutsch” und Region “Schweiz” einstellen also “de-CH”. In OS X 10.10 “Deutsch (Schweiz)” und Region “Schweiz” das ergibt ebenfalls “de-CH” als Sprache.

Im Terminal kann man jede App in jeder verfügbaren Sprache starten, doch das ist einfach zu kompliziert für den normalen Kunden.

cd MyApplication.app/Contents/MacOS
./MyApplication -AppleLanguages “(German)”

Gibt es da eine Lösung, ohne dass die Kunden die Systemeinstellung auf “Deutsch” ändern müssen.

kopier doch in einem Build Automatisation Schritte einfach den de.lproj Ordner nach de-CH.lproj.
Dann hast du die Texte doppelt, aber es sollte auf Deutsch sein.

Danke, das funktioniert.

In one of my apps I use an AppleScript which allows the user to switch the language for it:

Replace “MyApp” with the name of your application:

[code]–Autor: Kudusch
–Licence: CC BY-NC

–set the Application you want to work with
set vInput to “MyApp”

–Path and BundleID of application are safed in variables
try
set vPath to (path to application vInput) as string
set vBundle to bundle identifier of (info for (path to application vInput))
on error
error “You must choose an application!”
end try
set vPath to (path to application vInput) as string
set vBundle to bundle identifier of (info for (path to application vInput))

–check available localizations
tell application “Finder”
set vOut to {}
set vFolder to vPath & “Contents:Resources:” as string as alias
try
set vList to name of every folder in vFolder
on error
error “There are no localizations available!”
end try
set vList to name of every folder in vFolder
set n to 1
repeat while n ? (count items in vList)
set vTr to item n of vList
set AppleScript’s text item delimiters to {"."}
set vTr to every text item in vTr as list
if (count every item of vTr) > 1 and item 2 of vTr = “lproj” then
set AppleScript’s text item delimiters to {""}
set vOut to ((item 1 of vTr as list) & vOut)
end if
set n to n + 1
end repeat
end tell

–user chooses language
set dialog2 to choose from list vOut with prompt “MyApp language:”
set vLang to dialog2
if vLang = false then
error number -128
end if
set vLang to item 1 of vLang as text
–language is changed
set vScript to “defaults write " & vBundle & " AppleLanguages '(” & vLang & “)’”
do shell script vScript
tell application vInput to quit
delay 2
tell application vInput to activate
[/code]

In my case it looks like this:

Danke, Oliver. Das ist auch eine gute Lösung.