Apples solution to this is either to reinstall Mac OS X or select to show the input menu in the loginwindow, this is two solutions that I can't accept, so I started digging and found a solution!
The settings are stored in /Library/Preferences/com.apple.HIToolbox.plist and changing these solved my problem.
Here is quick and dirty script to change the default keyboard layout to Swedish:
#!/bin/bash
# This will set default keyboard language to Swedish.
# Path to plist file
PLISTDOMAIN="/Library/Preferences/com.apple.HIToolbox.plist"
# Path to PlistBuddy
PB="/usr/libexec/PlistBuddy"
"$PB" -c "set :AppleDefaultAsciiInputSource:KeyboardLayout\ ID 7" "$PLISTDOMAIN"
"$PB" -c "set :AppleDefaultAsciiInputSource:KeyboardLayout\ Name Swedish\ -\ Pro" "$PLISTDOMAIN"
"$PB" -c "set :AppleCurrentKeyboardLayoutInputSourceID com.apple.keylayout.Swedish-Pro" "$PLISTDOMAIN"
"$PB" -c "set :AppleEnabledInputSources:0:KeyboardLayout\ ID 7" "$PLISTDOMAIN"
"$PB" -c "set :AppleEnabledInputSources:0:KeyboardLayout\ Name Swedish\ -\ Pro" "$PLISTDOMAIN"
exit 0
# This will set default keyboard language to Swedish.
# Path to plist file
PLISTDOMAIN="/Library/Preferences/com.apple.HIToolbox.plist"
# Path to PlistBuddy
PB="/usr/libexec/PlistBuddy"
"$PB" -c "set :AppleDefaultAsciiInputSource:KeyboardLayout\ ID 7" "$PLISTDOMAIN"
"$PB" -c "set :AppleDefaultAsciiInputSource:KeyboardLayout\ Name Swedish\ -\ Pro" "$PLISTDOMAIN"
"$PB" -c "set :AppleCurrentKeyboardLayoutInputSourceID com.apple.keylayout.Swedish-Pro" "$PLISTDOMAIN"
"$PB" -c "set :AppleEnabledInputSources:0:KeyboardLayout\ ID 7" "$PLISTDOMAIN"
"$PB" -c "set :AppleEnabledInputSources:0:KeyboardLayout\ Name Swedish\ -\ Pro" "$PLISTDOMAIN"
exit 0