~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Doc/library/gettext.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
 
206
206
.. function:: install(domain[, localedir[, unicode [, codeset[, names]]]])
207
207
 
208
 
   This installs the function :func:`_` in Python's builtin namespace, based on
 
208
   This installs the function :func:`_` in Python's builtins namespace, based on
209
209
   *domain*, *localedir*, and *codeset* which are passed to the function
210
210
   :func:`translation`.  The *unicode* flag is passed to the resulting translation
211
 
   object's :meth:`install` method.
 
211
   object's :meth:`~NullTranslations.install` method.
212
212
 
213
213
   For the *names* parameter, please see the description of the translation
214
 
   object's :meth:`install` method.
 
214
   object's :meth:`~NullTranslations.install` method.
215
215
 
216
216
   As seen below, you usually mark the strings in your application that are
217
217
   candidates for translation, by wrapping them in a call to the :func:`_`
220
220
      print _('This string will be translated.')
221
221
 
222
222
   For convenience, you want the :func:`_` function to be installed in Python's
223
 
   builtin namespace, so it is easily accessible in all modules of your
 
223
   builtins namespace, so it is easily accessible in all modules of your
224
224
   application.
225
225
 
226
226
   .. versionchanged:: 2.4
347
347
      it binds :meth:`self.ugettext` instead.  By default, *unicode* is false.
348
348
 
349
349
      If the *names* parameter is given, it must be a sequence containing the
350
 
      names of functions you want to install in the builtin namespace in
 
350
      names of functions you want to install in the builtins namespace in
351
351
      addition to :func:`_`.  Supported names are ``'gettext'`` (bound to
352
352
      :meth:`self.gettext` or :meth:`self.ugettext` according to the *unicode*
353
353
      flag), ``'ngettext'`` (bound to :meth:`self.ngettext` or