I have an existing application in Django. I want to add a translation on the page. On page I have:
{% trans 'Projects'%}
In .po file I added:
#: templates/staff/site.html: 200
msgid "Projects"
msgid "Projekty"
Then executes the command:
django-admin.py compilemessages -l pl
After this command, I get an error:
CommandError: This Should Be Run script from the Django Git checkout or your project or app tree, or with the settings Specified module.
In Django templates, the translate tag allows you to translate either a constant string or variable content. In fact, you can mark a string to be translated via {{ _("Hello World") }} or {% trans "Hello World" %} .
The goal of internationalization and localization is to allow a single web application to offer its content in languages and formats tailored to the audience. Django has full support for translation of text, formatting of dates, times and numbers, and time zones.
Multilingual Support − Django supports multilingual websites through its built-in internationalization system. So you can develop your website, which would support multiple languages. Framework Support − Django has built-in support for Ajax, RSS, Caching and various other frameworks.
$ python manage.py compilemessages --settings nsp.settings
CommandError: This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.
I have got this error while I truly was inside project root folder.
The problem was, that I was running this command without python manage.py makemessages
first.
The error message is misleading.
The error holds the answer, you could be running the script from anywhere so it cannot know which files to compile. Run the command from the project directory or specify the settings and you should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With