0

Iam just putting localization into a django project. I want to pluralize a sentence, what looks like this:

{% blocktrans count count=rows.count %}
in {{ count }} row
{% plural %}
in {{ count }} rows
{% endblocktrans %}

not very pretty, but ok, still usable. (That is, by the way, how its described in the django documentation) But then it turns out, that it looks like this in django.po

msgid ""
"\n"
"    in %(count)s row\n"
"    "
msgid_plural ""
"\n"
"    in %(count)s rows\n"
"    "

That is really very unpretty. But I would have to change the template code to:

{% blocktrans count count=rows.count %}in {{ count }} row{% plural %}in {{ count }} rows{% endblocktrans %}

to make this better. That is pretty much unreadable. Is there no better way with django localization?

Asara
  • 2,791
  • 3
  • 26
  • 55

1 Answers1

0

No there isn't. The thing with the *.po files is that they will put the exact string to translate including spaces and new lines and that's a very good thing. That way translators will have the chance to replace/modify the spaces or new lines if they (or the target language) require to do.

If you want all in the same line, just write it as you just did.

You could check also your original code to remove unnecessary spaces at the end.

Raydel Miranda
  • 13,825
  • 3
  • 38
  • 60