Wie füge ich Django -Konstanten Übersetzungsunterstützung hinzu?Python

Python-Programme
Anonymous
 Wie füge ich Django -Konstanten Übersetzungsunterstützung hinzu?

Post by Anonymous »

Ich habe eine Django-Anwendung mit einigen in Constants definierten Wörterbüchern. Constants.py :

Code: Select all

from django.utils.translation import gettext_lazy as _
< /code>
und dann wie folgt angewendet: < /p>
{
"code": _("some name to be translated"),
# ....
}
< /code>
Dies scheint größtenteils zu funktionieren, aber ich stieß auf Probleme mit Sellerie- und Multiprozessierungsunterstützung zu, und alles, was versucht, meine Modelle auf etwas anderes als die Vanille -Art zu importieren.django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
, der selbst durch einen anderen Fehler verursacht wird:

Code: Select all

django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.

Das Traceback für letztere beginnt bei meiner Verwendung von getText_lazy in Constants.py .>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post