Changeset 756
- Timestamp:
- 10/01/05 07:56:12 (3 years ago)
- Files:
-
- django/branches/i18n/docs/translation.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/i18n/docs/translation.txt
r751 r756 50 50 51 51 The other two helper functions are similar in use:: 52 53 52 54 53 def hello_world(request, name, site): … … 70 69 is presented to the user. 71 70 71 There is a standard problem with translations, that is pluralization of 72 strings. This is done by the standard helper ngettext like so:: 73 74 def hello_world(request, count): 75 from django.utils.translation import ngettext 76 page = ngettext('there is %(count)d object', 'there are %(count)d objects', count) % { 77 'count': count, 78 } 79 return page 80 72 81 Using Translations in Templates 73 82 =============================== … … 81 90 <body> 82 91 <p>{% i18n _('Hello %(name)s, welcome at %(site)s!') %}</p> 92 <p>{% i18n ngettext('There is %(count)d file', 'There are %(count)d files', files|count) %}</p> 83 93 </body> 84 94 </html>
