Source

PyMSTranslator / mstranslator / tstring.py

Full commit
from endpoints.base import LANGUAGE_CODES

class TString(unicode):
    """Unicode string with lang attribute"""
    lang = None

    def __setattr__(self, name, v):
        if name != 'lang' and v not in LANGUAGE_CODES:
            raise ValueError('%s is not a valid language' % v)

        super(TString, self).__setattr__(name, v)