Script to correct first day of week in en_AU locale

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.

Tags:


Share This


 


7 Responses to Script to correct first day of week in en_AU locale

  1. [...] another post, I also show how to automate this, so it doesn’t get reset by Ubuntu’s automatic [...]

  2. Hi,

    Excellent.Nice article thanks for sharing.

  3. litle update is get locale automaticly :) whit
    locale | grep LANG | cut -d”=” -f2 | cut -d”.” -f1

  4. Did you consider, as an alternative to your script, changing your locale to GB?
    Check this: grep “first_weekday” /usr/share/i18n/locales/en_*

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>