Commits

Anonymous committed 7050c1a

Removed TRANSLATION_REGISTRY setting. The translation.py is supposed to be kept in the project root and this has to be in PYTHONPATH anyway.

Comments (0)

Files changed (5)

-The author of django-modeltranslation is Peter Eschler <peschler@gmail.com> 
-http://pyjax.net
+Peter Eschler <peschler@gmail.com> (http://www.pyjax.net)
+Dirk Eschler <eschler@gmail.com>
+  FIXED: Removed print statements so that modeltranslation is usable with
+         mod_wsgi.
+  FIXED: Broken admin fields and fieldsets.
+  FIXED: Creation of db fields with invalid python language code.
+  FIXED: Tests to run from any project.
+  FIXED: Removed unused dependency to content type which can break syncdb. 
+    
+CHANGED: Removed TRANSLATION_REGISTRY setting.
+
+  ADDED: Initial support for south.
+  ADDED: Support for admin inlines. 
+
+
+v0.1
+====
+
+Date: 2009-02-22
+
+Initial release packaged from revision 19. 

docs/modeltranslation/modeltranslation-wiki.txt

   # Add the `modeltranslation` app to the `INSTALLED_APPS` variable of your project's `settings.py`.
   # Configure your languages in the `settings.py`.
   # Create a `translation.py` in your project directory and register `TranslationOptions` for every model you want to translate.
-  # Configure the `TRANSLATION_REGISTRY` variable in your `settings.py`.
   # Sync the database using `manage.py syncdb` (note that this only applies if the models registered in the `translations.py` did not have been synced to the database before. If they did - read further down what to do in that case.
 
 
 
 Note that the `gettext` lambda function is not a feature of the modeltranslation app, but rather required for Django to be able to (statically) translate the verbose names of the languages using the standard `i18n` solution.
 
-*settings.TRANSLATION_REGISTRY*
-
-In order to be able to import the project's `translation.py` registration file the `TRANSLATION_REGISTRY` must be set to a value in the form `<PROJECT_MODULE>.translation`. E.g. if your project is located in a folder named `myproject` the `TRANSLATION_REGISTRY` must be set like this:
-
-{{{
-TRANSLATION_REGISTRY = "myproject.translation"
-}}}
-
 == Registering models and their fields for translation ==
 
 The `modeltranslation` app can translate `CharField` and `TextField`based fields of any model class. For each model to translate a translation option class containing the fields to translate must be registered with the `modeltranslation` app.

docs/modeltranslation/modeltranslation.txt

 3. Create a ``translation.py`` in your project directory and register
    ``TranslationOptions`` for every model you want to translate.
 
-4. Configure the ``TRANSLATION_REGISTRY`` variable in your ``settings.py``.
-
-5. Sync the database using ``manage.py syncdb`` (note that this only applies 
+4. Sync the database using ``manage.py syncdb`` (note that this only applies 
    if the models registered in the ``translations.py`` did not have been 
    synced to the database before. If they did - read further down what to do
    in that case.
 (statically) translate the verbose names of the languages using the standard
 ``i18n`` solution.
 
-**settings.TRANSLATION_REGISTRY**
-
-In order to be able to import the project's ``translation.py`` registration
-file the ``TRANSLATION_REGISTRY`` must be set to a value in the form
-``<PROJECT_MODULE>.translation``. E.g. if your project is located in a folder
-named ``myproject`` the ``TRANSLATION_REGISTRY`` must be set like this::
-
-    TRANSLATION_REGISTRY = "myproject.translation"
-
-
 Registering models and their fields for translation
 ---------------------------------------------------
 The ``modeltranslation`` app can translate ``CharField`` and ``TextField`` 

modeltranslation/models.py

 
 # 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
-# TODO: Consider removal of TRANSLATION_REGISTRY
-#       It is supposed to be kept in the project's root and this has to be in
-#       PYTHONPATH anyway.
 try: 
-    translation_mod = __import__(settings.TRANSLATION_REGISTRY, {}, {}, [''])
-except ImportError, exc:
-    raise ImportError("modeltranslation: TRANSLATION_REGISTRY '%s' not found." 
-                      % settings.TRANSLATION_REGISTRY)
+    import translation
+except ImportError:
+    import sys
+    sys.stderr.write("modeltranslation: Error can't find the file " \
+                     "'translation.py' in your project root.\n")
+    sys.exit(1)
 
 # After importing all translation modules, all translation classes are 
 # registered with the translator.
 if settings.DEBUG:
-    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)
+    translated_model_names = ', '.join(
+        t.__name__ for t in translator._registry.keys())
+    print "modeltranslation: Registered %d models for translation (%s)." % (
+        len(translator._registry), translated_model_names)