django-orchestra/orchestra/core/translations.py

14 lines
400 B
Python
Raw Normal View History

2015-03-29 16:10:07 +00:00
class ModelTranslation(object):
"""
Collects all model fields that would be translated
using 'makemessages --domain database' management command
"""
_registry = {}
@classmethod
def register(cls, model, fields):
if model in cls._registry:
raise ValueError("Model %s already registered." % model.__name__)
cls._registry[model] = fields