'Attempt to load an XBlock-specific GNU gettext translator using the XBlock\'s own domain
translation catalog, currently expected to be found at:
<xblock_root>/conf/locale/<language>/LC_MESSAGES/<domain>.po|mo
If we can\'t locate the domain translation catalog then we fall-back onto
django.utils.translation, which will point to the system\'s own domain translation catalog
This effectively achieves translations by coincidence for an XBlock which does not provide
its own dedicated translation catalog along with its implementation.'

def __init__(self, block=None):

    self.translator = django.utils.translation
    if block:
        xblock_class = getattr(block, 'unmixed_class', block.__class__)
        xblock_resource = xblock_class.__module__
        xblock_locale_dir = '/translations'
        xblock_locale_path = resource_filename(xblock_resource, xblock_locale_dir)
        xblock_domain = 'text'
        selected_language = get_language()
        try:
            self.translator = gettext.translation(xblock_domain, xblock_locale_path, [to_locale((selected_language if selected_language else settings.LANGUAGE_CODE))])
        except IOError:
            pass
