Difference between revisions of "Artenquiz documentation"
From Biowikifarm Metawiki
m (→Change translations) |
m (→Change translations: +docu) |
||
Line 53: | Line 53: | ||
== Change translations == | == Change translations == | ||
− | + | (1) | |
<source lang="html4strict"> | <source lang="html4strict"> | ||
<!-- in /templates/mytemplate.html --> | <!-- in /templates/mytemplate.html --> | ||
Line 62: | Line 62: | ||
</source > | </source > | ||
+ | (2) | ||
<source lang="bash"> | <source lang="bash"> | ||
# move to base directory of artenquiz app | # move to base directory of artenquiz app | ||
cd /artenquiz/django/artenbestimmung | cd /artenquiz/django/artenbestimmung | ||
− | django-admin.py makemessages -l de --extension='.html,.txt' && django-admin.py makemessages -l en --extension='.html,.txt' | + | django-admin.py help makemessages # show the help |
+ | django-admin.py makemessages --no-wrap -l de --extension='.html,.txt' && django-admin.py makemessages --no-wrap -l en --extension='.html,.txt' | ||
</source > | </source > | ||
+ | (3) | ||
Add translations at least in | Add translations at least in | ||
* <code>/artenbestimmung/locale/de/LC_MESSAGES/django.po</code> | * <code>/artenbestimmung/locale/de/LC_MESSAGES/django.po</code> | ||
+ | * note that <code>#, fuzzy</code> becomes not translated, you may remove it and make sure you have an exact msgid or change it to <code>#, use-fuzzy</code> (?undocumented hack? because msgfmt has <code>msgfmt --use-fuzzy</code>) | ||
+ | (4) | ||
<source lang="bash"> | <source lang="bash"> | ||
# move to base directory of artenquiz app | # move to base directory of artenquiz app | ||
Line 76: | Line 81: | ||
django-admin.py compilemessages | django-admin.py compilemessages | ||
</source > | </source > | ||
+ | |||
+ | (5) (eventually) restart the server | ||
+ | <source lang="bash"> | ||
+ | sudo /usr/sbin/apache2ctl -k graceful # or not graceful: sudo /usr/sbin/apache2ctl -k restart | ||
+ | </source> |
Revision as of 10:40, 3 January 2012
(See also Django-Installation and Django at a glance)
The test version for Artenquiz is running under:
An admin interface for django users having a special admin account is available at:
- http://artenquiz.biowikifarm.net/admin/
- http://artenquiz.biowikifarm.net/admin/doc/ (automatic documentation generated if Python's docutils is available)
Subversion directory is:
- https://biowikifarm.net/svn/artenquiz/ (you must be e registered user for svn to get access)
Folder structure
/var/www/v-artenquiz/django/ ├ /apache (redirect/URL settings) ├ /artenbestimmung (projects artenquiz + artenbestimmung) · http://artenquiz.biowikifarm.net/ · http://artenquiz.biowikifarm.net/identification/ · /accounts (backend for user_name or email login) · /artenquiz · /management · /commands (various import tools) · USAGE: · cd /path-to/artenbestimmung · python manage.py help importtaxa · python manage.py importtaxa /path-to/datafile.csv · /templatetags (custom tags used in templates) · /static (static CSS styles, JavaScript files, icons) · /tools (python script tools) · /local (generated localization files and defined English translations) · /register (definitions of registration) · /report (simple reports of descriptions for admins) · /templates (all django XHTML-templates) ├ /data (data for import) └ /doc (python + django documentation as freemind-mind-map; current database schema)
Create a new project
You can start a django app by:
cd my-dj-project-folder
django-admin.py help startapp
django-admin.py startapp my-app-folder
# a it needs always __init__.py!!!!
To let a django application get to work, you need (in general) the following files:
__init__.py (a 0Byte file needed by python) url.py (URL pattern definitions) models.py (data-model definitions) views.py (view layer: form request definitions, form processing) mytemplate.html (a template to process, see also admin/doc/)
Change translations
(1)
<!-- in /templates/mytemplate.html -->
{% trans "Short localised message" %}
{% blocktrans %}Localised message
spanning multiple lines{% endblocktrans %}
<!-- in /templates/mytemplate.html -->
(2)
# move to base directory of artenquiz app
cd /artenquiz/django/artenbestimmung
django-admin.py help makemessages # show the help
django-admin.py makemessages --no-wrap -l de --extension='.html,.txt' && django-admin.py makemessages --no-wrap -l en --extension='.html,.txt'
(3) Add translations at least in
-
/artenbestimmung/locale/de/LC_MESSAGES/django.po
- note that
#, fuzzy
becomes not translated, you may remove it and make sure you have an exact msgid or change it to#, use-fuzzy
(?undocumented hack? because msgfmt hasmsgfmt --use-fuzzy
)
(4)
# move to base directory of artenquiz app
cd /artenquiz/django/artenbestimmung
django-admin.py compilemessages
(5) (eventually) restart the server
sudo /usr/sbin/apache2ctl -k graceful # or not graceful: sudo /usr/sbin/apache2ctl -k restart