Bug 1024887 - Move language related code to a separate module

https://bugzilla.mozilla.org/show_bug.cgi?id=1024887