On Thu, Apr 18, 2013 at 4:42 PM, Cody Scott <
cody.j....@gmail.com> wrote:
> I am trying to view my site in japanese. I have create the translations and
> compiled them with compilemessages.
>
> In my urls.py I have
>
> urlpatterns = i18n_patterns('',
> #...
> )
>
>
> Settings.py
>
>
> LANGUAGE_CODE = 'en-us'
>
> #Used for translations
> gettext = lambda s: s
> LANGUAGES = (
> ('en', gettext('English')),
> ('jp', gettext('Japanese')),
> )
Django only supports translations that Django itself has a base
translation for. Django has a Japanese translation, but it uses the
correct ISO-639-1 language name for it, 'ja'. Since you have 'jp',
this doesn't correspond to a language that django has a base
translation for, and so it is ignored.
>
>
> But when I try to access a url with /jp/ at the start I get that there is
> only /en/
>
>
> Using the URLconf defined in PLP.urls, Django tried these URL patterns, in
> this order:
> ^en/
> The current URL, jp/accounts/login, didn't match any of these.
>
>
>
> I am using dbgettext so I also have my database content translated in my
> messages.
>
> But how can I display it
>
> {% trans "Question:" %}{% trans {{question.question}} %}<br>
>
> Could not parse the remainder: '{{question.question}}' from
> '{{question.question}}'
>
You can't use {{ }} inside a template tag, but you don't need to. {%
trans %} is expecting either a string literal or a variable, so give
it the variable - {% trans question.question %}.
Cheers
Tom