Script to correct first day of week in en_AU locale
| 26-Oct-2009 | Posted by Sonia Hamilton under Ubuntu |
I blogged previously about how the Australian locale in Ubuntu incorrectly uses Sunday rather than Monday as the first day of the week, and how to manually fix it. Unfortunately, whenever the locale gets updated (eg via one of Ubuntu’s regular package updates), the locale reverts and you have to manually fix it again.
So I’ve written a script that fixes the locale, and also hooked it into dpkg:
% cat fix_locale.sh #!/bin/bash LOCALE_FILE='/usr/share/i18n/locales/en_AU' if [ -f $LOCALE_FILE ] ; then sudo sed -i 's/^first_weekday.*/first_weekday 2/' $LOCALE_FILE sudo locale-gen killall gnome-panel fi
To run this automatically, add a stanza like this to /etc/apt/apt.conf:
APT {
Update {
Post-Invoke {"/home/sonia/bin/fix_locale.sh"; };
};
};
The script could be smarter ie check the existing value of first_weekday and only change it if it’s different, but I’ll fix that when I’ve got more time.
Share This
[...] another post, I also show how to automate this, so it doesn’t get reset by Ubuntu’s automatic [...]
Hi,
Excellent.Nice article thanks for sharing.
litle update is get locale automaticly :) whit
locale | grep LANG | cut -d”=” -f2 | cut -d”.” -f1
Did you consider, as an alternative to your script, changing your locale to GB?
Check this: grep “first_weekday” /usr/share/i18n/locales/en_*
Thanks! I might diff the GB & AU locales, adapt some of the stuff.
Just wanted to add that I find it very cool what you did with the script.
Thanks! Coolness is good…