property activeLanguage : "" set theLanguages to {"English", "German", "French", "Italian", "Swiss"} set theLocalisedLanguages to {"Englisch", "Deutsch", "Franzšsisch", "Italienisch", "Schweizerisch"} set myShortLanguages to {"en", "de", "fr", "it", "ch"} # The prompts could be localised as wellÉ if activeLanguage is "" then # set oldLanguage to choose from list theLocalisedLanguages with title  # "Sprachauswahl zur Silbentrennung" with prompt "Bitte geben Sie die aktuell zur Silbentrennung benutzte Sprache an:" OK button name "WŠhlen" cancel button name "Abbrechen" set oldLanguage to choose from list theLanguages with title  "Selection of Hyphenation Language" with prompt  "Please indicate your current setting of hyphenation language:" OK button name "Select" cancel button name "Cancel" if the result is false then return set activeLanguage to switch(item 1 of oldLanguage, theLanguages, myShortLanguages) end if # set newLanguage to choose from list theLocalisedLanguages with title  # "Sprachauswahl zur Silbentrennung" with prompt "Die aktuelle Sprache ist " & switch(activeLanguage, myShortLanguages, theLocalisedLanguages) & "." & return &  # "WŠhlen Sie ihre Sprache:" OK button name "Umstellen" cancel button name "Nichts tun" set newLanguage to choose from list theLanguages with title  "Selection of Hyphenation Language" with prompt "The current language is " & switch(activeLanguage, myShortLanguages, theLanguages) & "." & return &  "Please select your language:" OK button name "Change" cancel button name "Cancel" if the result is false then return set newShortLanguage to switch(item 1 of newLanguage, theLanguages, myShortLanguages) set myHyphPath to "/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/" set activeFile to myHyphPath & "English-Hyphenation.txt" set languageFile to myHyphPath & "Hyphenation-" & activeLanguage & ".txt" set newLanguageFile to myHyphPath & "Hyphenation-" & newShortLanguage & ".txt" tell application "System Events" if exists file languageFile then # tell me to display dialog "Es gibt einen Dateikonflikt: die Datei\n'Hyphenation-" & activeLanguage & ".txt'\nexistiert schon in" & return &  # myHyphPath & ",\ndie Datei 'English-Hyphenation.txt' kann daher nicht in sie umbenannt werden.\nBitte prŸfen!" tell me to display dialog "There is a conflict: the file\n'Hyphenation-" & activeLanguage & ".txt'\nis already present in" & return &  myHyphPath & ",\nthe file 'English-Hyphenation.txt' cannot be renamed to that.\nPlease check!" return end if if not (exists file newLanguageFile) then # choose file with prompt "Wo ist die Trenndatei fŸr " & newLanguage & "?" & return & "Bitte auswŠhlen:" choose file with prompt "Where is the hyphenation file for " & newLanguage & "?" & return & "Please choose:" set externalLanguageFile to the POSIX path of the result tell me to do shell script ("cp " & externalLanguageFile & " " & newLanguageFile) with administrator privileges end if if exists file activeFile then try set switchScript to "mv " & activeFile & " " & languageFile & "\nmv " & newLanguageFile & " " & activeFile & "\n" tell me to do shell script switchScript with administrator privileges set activeLanguage to newShortLanguage end try end if end tell on switch(theItem, list1, list2) (* set the text item delimiters to {","} set testList to (list1 as text) set myNum to item2Num(theItem, list1) display dialog (myNum & return & theItem & return & testList) as text *) return item (item2Num(theItem, list1)) of list2 end switch on item2Num(theItem, theList) repeat with i from 1 to the count of theList if item i of theList = theItem then return i end repeat return 0 end item2Num