'Build mock translator for the given locales.
Returns a mock gettext.translation function that uses
individual TestTranslations to translate in the given locales.
:param locales_map: A map from locale name to a translations map.
\'es\': {\'Hi\': \'Hola\', \'Bye\': \'Adios\'},
\'zh\': {\'Hi\': \'Ni Hao\', \'Bye\': \'Zaijian\'}'

@staticmethod
def translator(locales_map):

    def _translation(domain, localedir=None, languages=None):
        '\n                                                return    gettext.translation    for    given    language\n                                                '
        if languages:
            language = languages[0]
            if (language in locales_map):
                return FakeTranslations(locales_map[language])
        return gettext.NullTranslations()
    return _translation
