`locale` dependency in `nls` middleware wrap function is now correctly used.
Extracted some functionality to other files.