Handle . and - in translation domains

Refactor the bit of code used to build the translation
domain variable name so it can be tested more easily.

If a translation domain includes '.' or '-' in the name,
replace them with '_' when building the environment variable
name.

bp graduate-oslo-i18n

Change-Id: I149bf82b9802f88d33d8a5b82dc32817305ca2fe