django - How to view your translated site? -


i trying view site in japanese. have create translations , compiled them compilemessages.

in urls.py have

urlpatterns = i18n_patterns('',     #... ) 

settings.py

language_code = 'en-us'  #used translations gettext = lambda s: s languages = (     ('en', gettext('english')),     ('jp', gettext('japanese')),     ) 

but when try access url /jp/ @ start there /en/

using urlconf defined in plp.urls, django tried these url patterns, in order:

^en/ 

the current url, jp/accounts/login, didn't match of these.

i using dbgettext have database content translated in messages.

but how can display it

   {% trans "question:" %}{% trans {{question.question}} %}<br> 

could not parse remainder: '{{question.question}}' '{{question.question}}'

edit

thanks ngenator!

my other issue japanese 'ja' not 'jp'

well {% trans %} tag takes variable directly, don't need braces,

{% trans "question:" %}{% trans question.question %}<br> 

or using {% blocktrans %} tag

{% blocktrans %}question: {{ question.question }}{% endblocktrans %} 

should work. i'm not sure url issues though.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -