Re: blocktrans inside a with tag

49 views
Skip to first unread message

ernando

unread,
Aug 15, 2012, 10:26:28 AM8/15/12
to django...@googlegroups.com
I really didn't try to use  blocktrans and with tags together but why do use val variable value with $ sign? Try just {{val}} one - it works ok for me.

- Dmitry

On Tuesday, August 14, 2012 2:41:16 AM UTC+3, Jason Buckner wrote:
I would like to use a blocktrans tag inside a with tag so I can dynamically pass values to multiple blocktrans blocks. For instance:

{% with cost="250" %}
    {% blocktrans with val=cost %} Blah blah ${{val}} {% endblocktrans %}
    .
    .
    .
    {% blocktrans with val=cost %} Blah blah ${{val}} {% endblocktrans %}
{% endwith %}

This produces empty {{ val }} values.

Is this possible?

Melvyn Sopacua

unread,
Aug 15, 2012, 11:33:27 AM8/15/12
to django...@googlegroups.com
On 15-8-2012 16:26, ernando wrote:
> I really didn't try to use blocktrans and with tags together but why do
> use val variable value with $ sign? Try just {{val}} one - it works ok for
> me.
Because it's a monetary ammount?

--
Melvyn Sopacua

ernando

unread,
Aug 15, 2012, 1:27:30 PM8/15/12
to django...@googlegroups.com
Sorry, didn't catch it :)

I just checked provided code - and it works ok (1.4 Django). Are u using the latest version or 1.3 one?

-Dmitry

dipo.e...@dipoelegbede.com

unread,
Aug 15, 2012, 2:48:33 PM8/15/12
to django...@googlegroups.com
H
Sent from my BlackBerry wireless device from MTN

From: ernando <dmitry....@gmail.com>
Date: Wed, 15 Aug 2012 10:27:30 -0700 (PDT)
Subject: Re: blocktrans inside a with tag

Sorry, didn't catch it :)

I just checked provided code - and it works ok (1.4 Django). Are u using the latest version or 1.3 one?

-Dmitry

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/vqf-i_qCXI0J.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Melvyn Sopacua

unread,
Aug 15, 2012, 7:25:51 PM8/15/12
to django...@googlegroups.com
On 15-8-2012 19:27, ernando wrote:

> I just checked provided code - and it works ok (1.4 Django). Are u using
> the latest version or 1.3 one?

Actually, my reply was a bit in a hurry cause I was on my way out. The
dollar sign means nothing to python or django templates, so it is just
raw text. Just to make sure no one thinks from my reading my reply that
dollar signs formats stuff as monetary ;)

On the OP's problem: make sure your translation file kept the format
string. The block will end up as:
#, python-format
msgid "Blah Blah $%(val)"
msgstr "..."

--
Melvyn Sopacua
Reply all
Reply to author
Forward
0 new messages