Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango translation returning the same strings
    text
    copied!<p>I am setting up a new small project to try i18n in Django 1.4.3 (English and Dutch). But I think I'm missing a step, as it is not translating the strings.</p> <p>Who can tell me what I need to do to get the translated strings? How can I debug?</p> <p><strong>settings.py</strong>:</p> <pre><code>gettext = lambda s: s LANGUAGES = ( ('nl', gettext('Dutch')), ('en', gettext('English')), ) LOCALE_PATH= ( '/var/www/test/locale', ) # django.middleware.locale.LocaleMiddleware is also included @ MIDDLEWARE_CLASSES </code></pre> <p>The <strong>urls.py</strong> file:</p> <pre><code>urlpatterns = i18n_patterns('', #home url(r'^$','bday.views.home',name="index"), ) </code></pre> <p><strong>views.py</strong> in project:</p> <pre><code>from django.utils.translation import ugettext as _ def home(request): text=_("Welcome!") return HttpResponse("LANG[{}], TEXT[{}]".format( request.LANGUAGE_CODE, text ) ) </code></pre> <p>/var/www/test/locale/<strong>nl</strong>/LC_MESSAGES/django.<strong>po</strong></p> <pre><code>#: bday/views.py:16 msgid "Welcome!" msgstr "Welkon in Nederlands" </code></pre> <p>/var/www/test/locale/<strong>en</strong>/LC_MESSAGES/django.<strong>po</strong></p> <pre><code>#: bday/views.py:16 msgid "Welcome!" msgstr "Welcome in English" </code></pre> <p>The messages do get compiled, I get:</p> <pre><code>./manage.py compilemessages processing file django.po in /var/www/test/locale/nl/LC_MESSAGES processing file django.po in /var/www/test/locale/en/LC_MESSAGES </code></pre> <p>But in my app, I'm getting:</p> <pre><code>$ curl "http://www.host.com:8000/nl/" LANG[nl], TEXT[Welcome!] $ curl "http://www.host.com:8000/en/" LANG[en], TEXT[Welcome!] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload