@@ -116,23 +116,20 @@ A newly created translation needs a few initial preparations:
116
116
Note for developers
117
117
-------------------
118
118
119
- Since we support newstyle gettext there is no need to use the
120
- ``format() ``-Method in internationalized Strings anymore. An example
121
- will explain this: instead of
122
- ``_('Hello %(name)s!') % dict(name='World') `` you can just
123
- write ``_('Hello %(name)s!', name='World') ``.
119
+ We use the ``format() ``-Method in internationalized Strings, e.g.
120
+ ``_('Hello {name}').format(name='World') ``. ``_() `` is an alias for ``gettext() ``
124
121
125
122
If the translatable string contains a variable plural, that means
126
- the string contains an object which you don't know the exact quantity
127
- of, then you will have to use
128
- `` ngettext() ``. Note that this is not only needed for the decision
123
+ the string contains an object whose exact number you don't know,
124
+ you will have to use `` N_() ``, which is an alias for `` ngettext() ``.
125
+ Note that this is not only needed for the decision
129
126
between one and more objects, because other languages have other
130
127
and more difficult plurals than English. The usage is
131
- ``ngettext (singular, plural, num, **variables) ``. ``**variables ``
132
- enables you to use the newstyle form as explained above.
128
+ ``N_ (singular, plural, num).format( **variables) ``. ``**variables ``
129
+ are used to substitute the keys by `` format() `` as explained above.
133
130
134
- For example :
135
- ``ngettext("%( number)d file removed from %( directory)s", "%( number)d files removed from %( directory)s" , num=n, number=n, directory=directory) ``
131
+ Example :
132
+ ``N_('{ number} file removed from { directory}', '{ number} files removed from { directory}' , num=n).format( number=n, directory=directory) ``
136
133
137
134
``n `` has to appear twice because the first gives ngettext() information
138
135
about the exact number and the second is the variable for the format
0 commit comments