How to select and generate locales on Ubuntu

For those of you who are used to running “dpkg-reconfigure locales” on Debian to select and generate locales you may be a bit disappointed at the seemingly broken way it is done under Ubuntu.