Copy recent changes in periodic tasks from nova.

The nova periodic task code has moved on. Bring oslo inline with
the new code. The next step after this is to update Quantum (the
only user of this code I can find) to the new interface, and then
move nova across to using this code.

Change-Id: I3f041ca9a6ba9f0e5be4b29198d16454c9797fef
Add a gettextutils.install() helper function

Part of fixing bug #995287

Every top-level script in every project needs to call gettext.install()
so that a _() builtin function is installed and strings are translated
using the correct translation domain.

However, translations are always installed in the default localedir
(which is commonly '/usr/share/locale') and, in cases like devstack, may
be found in a project-specific localedir. To support such a use case we
should have project-specific environment variables for overriding the
default value of localedir - e.g. NOVA_LOCALEDIR.

Add a new gettextutils.install() helper method to make this as easy as
possible for projects to get right.

Change-Id: I6c8549c8ff00797c96f2dd4b0b5266d18d77aa19
Support overriding oslo localedir too

Part of fixing bug #995287

Libraries need to translate strings according to their translation
domain but they should not override the default _() builtin (which
should only be installed by the top-level script) and instead should
gettextutils._().

To support the case where message catalogs are installed in a
non-default (and perhaps project-specific) location, we allow the
default localedir to be override with a project-specific environment
variable e.g. QUANTUMCLIENT_LOCALEDIR.

The code makes it seem like OSLO_LOCALEDIR is the env variable we're
adding but, in fact, update.py magically replaces 'oslo' with the
project name.

Change-Id: I62b66892a4e27892ee488d2884ffd2f40ab467ee
Merge "Add a gettextutils.install() helper function"
Merge "Support overriding oslo localedir too"