add unit test for LocaleListener
cs
move locale determination to a separate method

This piece of code is likely to be overriden in child classes with a
custom logic.
Merge pull request #166 from greg0ire/extensibility

Extensibility