def gettext_getfunc( lang ):
    """
    Returns a function used to translate to a specific catalog.
    """
    # Note: you would get the gettext catalog here and install it in the
    # closure.

    def tr( s ):
        # Note: we do not really translate here, we just prepend the
        # language, but you get the idea.
        return '[%s] %s' % (lang, s)

    return tr

    Returns a function used to translate to a specific catalog.
    
recipes/Python/465756_Builti18n__functimultithreaded/recipe-465756.py