--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/modeltranslation/models.py Thu Jan 21 18:41:10 2010 +0100
@@ -0,0 +1,25 @@
+
+from django.db import models
+from django.conf import settings
+
+from modeltranslation.translator import translator
+
+# Every model registered with the modeltranslation.translator.translator
+# is patched to contain additional localized versions for every
+# field specified in the model's translation options.
+
+# Import the project's global "translation.py" which registers model
+# classes and their translation options with the translator object.
+# This requires an extra settings entry, because I see no other way
+# to determine the module name of the project
+try:
+ translation_mod = __import__(settings.TRANSLATION_REGISTRY, {}, {}, [''])
+except ImportError, exc:
+ print "No translation.py found in the project directory."
+ #raise ImportError("No translation.py found in the project directory.")
+
+# After importing all translation modules, all translation classes are
+# registered with the translator.
+translated_app_names = ', '.join(t.__name__ for t in translator._registry.keys())
+print "modeltranslation: registered %d applications for translation (%s)." % (len(translator._registry),
+ translated_app_names)