Django I18n Translation of The whole document - django

when i start translating the django application.
{% trans 'Profilbild'%}
All other trans blocks with umlaut are not translated. What is the solution ?
Regards

That's not how it works, the i18n tag translates a string or variable, it only takes one argument. Did you read the documentation?
You probably want blocktrans
UPDATE (the OP changed the question):
Did you run makemessages -l <desired_lang> successfully
Did you run compilemessages successfully
Did you restart the Django process after these steps?

Related

why my django groundwork doesn't work

I install django-groundwork by pip and set add 'groundwork' to the my django app but it seems doesn't work,I don't know why?When I use command 'python manage.py help' to check which command could be used ,there is no 'ground' but the module dose exist.Please give me some help
The groundwork pagkage doesn't provide any management commands. It only provides some templates and template tags. That's why you're not seeing anything when calling manage.py (or django-admin.py'
The docs say it clearly, but you can check out the code... there's simply no management/commands directory inside the installed package.
Groundwork is a small set of template tags and filters that simplifies
working with Zurb Foundation
To truly say that the application "doesn't work", you'd have to use the template tags it provides.
Do this in a template
{% load groundwork_tags %}
Then do this
{% groundwork_icon 'info' '5em' 'text-centered' %}
If that breaks your template, it means the app isn't properly installed, is broken, or otherwise there's something else wrong.
Read about django management commands a little, it will all be clear (make sure to read about the version of django that you have installed.. the link will always point to the development version so things might be different there):
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/

Django: blocktrans not working anymore

In my current project blocktrans is not working anymore (it used to work just fine). trans or one-line-blocktrans work just fine, only multi-line-blocktrans fail. django-admin.py makemessages still picks all these messages up correctly, but in the output the default (en) language will be shown instead of the translated.
Using the python shell I can retrieve the translation. It's the template/localization where system doesn't seem to retrieve the translations. Inside python manage.py shell:
from django.utils import translation
s = "the text"
translation.activate('en')
translation.ugettext(s) # gets the default text
translation.activate('hi')
translation.ugettext(s) # gets the correct translated text
The messages are not fuzzy
I tried to make the translation have as many lines as the original
I'm still on django 1.1
What could I be missing/doing wrong?

Django i18n: makemessages only on site level possible?

I have several strings in my site that don't belong to any app, for example
{% block title %}{% trans "Login" %}{% endblock %}
or a modified authentication form used to set the locale cookie
class AuthenticationFormWithLocaleOption(AuthenticationForm):
locale = forms.ChoiceField(choices = settings.LANGUAGES,
required = False,
initial = preselectedLocale,
label = _("Locale/language"))
Now when I execute django-admin.py makemessages --all -e .html,.template in the site directory, it extracts the strings from all Python, .html and .template files, including those in my apps. That is because I develop my apps inside that directory:
Directory structure:
sitename
myapp1
myapp2
Is there any way to extract all strings that are not in my apps?
The only solution I found is to move the app directories outside the site directory structure, but I'm using bzr-externals (similar to git submodules or svn externals) so that doesn't make sense in my case.
Moving stuff that needs translation into a new app is also possible but I don't know if that is the only reasonable solution.
According to the documentation you could run makemessages from the app you like to translate, creating only the message files for that specific app. It is also possible to filter out some specific folders by using makemessages' --ignore argument. The results between those two would be quite different, though.

Textile renders to HTML, but Django is escaping it

I have a bunch of posts stored in text files formatted in yaml/textile (from Jekyll) that I am trying to import into my new Django project. The problem is that Django is escaping the actual html code, meaning my post is not getting formatted. How can I got about fixing this? should I change something in the jekyll-import command (a custom manage.py command), the postgresql server, or the views.py file?
Example:
The one thing I can’t do is write about myself. Hell, look at my about me page.
Well, I figured it out right after I posted it. I had tried this before but used the wrong syntax. To do this I just had to add '|safe' to the end of my body tag.
Like so:
{{ body|safe }}
Very nice.

Cannot Extend Django 1.2.1 Admin Template

I am attempting to override/extend the header for the Django admin in version 1.2.1. However when I try to extend the admin template and simply change what I need documented here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template), I run into a recursion problem.
I have an index.html file in my project's templates/admin/ directory that starts with
{% extends "admin/index.html" %}
But it seems that this is referencing the local index file (a.k.a. itself) rather than the default Django copy. I want to extend the default Django template and simply change a few blocks. When I try this file, I get a recursion depth error.
How can I extend parts of the admin? Thanks.
SOLUTION: Rather than extending, I copied the files into my_templates_directory/admin/ and just edited them as I wished. This solution was acceptable, though not ideal.
The contrib/admin/templates/admin path needs to go before the directory with your custom admin templates in your list of paths in TEMPLATE_DIRS in your settings.py
Create a symlink to contrib/admin/templates/admin/ in your templates directory and use it in your {% extends %} statement.
cd /path/to/project/templates/
ln -s /path/to/django/contrib/admin/templates/admin/ django_admin
Now in your admin/index.html use {% extends "django_admin/index.html" %}
EDIT: Just realized that you're on windows... Not sure how to achieve the same results. Hopefully this still helps the folks on linux.
SOLUTION: Rather than extending, I copied the files into my_templates_directory/admin/ and just edited them as I wished. This solution was acceptable, though not ideal.