Files changed (5)
# Create a `translation.py` in your project directory and register `TranslationOptions` for every model you want to translate.
# 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.
-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:
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.
- print "modeltranslation: registered %d applications for translation (%s)." % (len(translator._registry), translated_app_names)