[Answered ]-Modeltranslation app doesn't add translated fields in models

1👍

Does modeltranslation load at all? Using the development server manage.py runserver prints debug information to stdout.

Validating models...

modeltranslation: Registered 2 models for translation (Foo, Bar) [pid:12345].
0 errors found
[...]

If you don’t see this (and you haven’t deactivated DEBUG) I suppose something goes wrong at import time.

Also which modeltranslation version do you use?

The TRANSLATION_REGISTRY setting is deprecated since 0.3, which switched to consistent prefixes, so it became MODELTRANSLATION_TRANSLATION_REGISTRY.

In 0.4 per-app level translation files were introduced making this setting completely optional. Instead each app is now automatically searched for a translation.py in its root directory. At the same time MODELTRANSLATION_TRANSLATION_FILES was added. Also being optional it allows to extend the list of translation files.

While support for MODELTRANSLATION_TRANSLATION_REGISTRY is kept even in the latest development version to retain backwards compatibility, it is no longer recommended to use it. Instead just put the translation.py into the directory of the app you want to translate.

Finally, the fields attribute in your translation.py is supposed to be a tuple (or list), where you are defining a string. Python will only recognize it as a tuple when you add a comma like this:

class TestTranslationOptions(TranslationOptions):
    fields = ('display',)

I suppose it’s a typo in your question, because I expect modeltranslation to bail out if it can’t find the fields.

1👍

You are using south, so You have to do ./manage.py migrate to translate your fields . Hope this help

Leave a comment