Lines Matching +refs:po +refs:find +refs:string +refs:function
37 .. function:: bindtextdomain(domain, localedir=None)
49 .. function:: bind_textdomain_codeset(domain, codeset=None)
59 .. function:: textdomain(domain=None)
67 .. function:: gettext(message)
70 domain, language, and locale directory. This function is usually aliased as
74 .. function:: dgettext(domain, message)
79 .. function:: ngettext(singular, plural, n)
90 for the precise syntax to be used in :file:`.po` files and the
94 .. function:: dngettext(domain, singular, plural, n)
99 .. function:: pgettext(context, message)
100 .. function:: dpgettext(domain, context, message)
101 .. function:: npgettext(context, singular, plural, n)
102 .. function:: dnpgettext(domain, context, singular, plural, n)
111 .. function:: lgettext(message)
112 .. function:: ldgettext(domain, message)
113 .. function:: lngettext(singular, plural, n)
114 .. function:: ldngettext(domain, singular, plural, n)
118 but the translation is returned as a byte string encoded in the preferred
144 print(_('This is a translatable string.'))
155 install themselves in the built-in namespace as the function :func:`_`.
158 .. function:: find(domain, localedir=None, languages=None, all=False)
160 This function implements the standard :file:`.mo` file search algorithm. It
163 strings, where each string is a language code.
173 :func:`find` then expands and normalizes the languages, and then iterates
178 The first such file name that exists is returned by :func:`find`. If no such
184 .. function:: translation(domain, localedir=None, languages=None, class_=None, fallback=False, code…
187 and *languages*, which are first passed to :func:`find` to get a list of the
201 If no :file:`.mo` file is found, this function raises :exc:`OSError` if
212 .. function:: install(domain, localedir=None, codeset=None, names=None)
214 This installs the function :func:`_` in Python's builtins namespace, based on
215 *domain*, *localedir*, and *codeset* which are passed to the function
223 function, like this::
225 print(_('This string will be translated.'))
227 For convenience, you want the :func:`_` function to be installed in Python's
301 is returned as a byte string encoded in the preferred system encoding
308 :func:`lgettext` function.
350 the :func:`_` function available to your application. Because it affects
376 the translation for the empty string. This metadata is in :rfc:`822`\ -style
401 string, as a Unicode string. If there is no entry in the catalog for the
411 plural form to use. The returned message string is a Unicode string.
431 corresponding message string, as a Unicode string. If there is no
457 is returned as a byte string encoded in the preferred system encoding
464 :func:`lgettext` function.
490 For compatibility with this older module, the function :func:`Catalog` is an
491 alias for the :func:`translation` function described above.
516 your files. Any string that needs to be translated should be marked by wrapping
517 it in ``_('...')`` --- that is, a call to the function :func:`_`. For example::
524 In this example, the string ``'writing a log message'`` is marked as a candidate
530 in a number of languages, including Python, to find strings marked as
535 his `po-utils package <https://github.com/pinard/po-utils>`__.
550 :file:`.po` files that are message catalogs. They are structured
551 human-readable files that contain every marked string in the source
555 Copies of these :file:`.po` files are then handed over to the
558 language-specific versions as a :file:`<language-name>.po` file that's
589 If you are localizing your application, you can install the :func:`_` function
601 :func:`install` function::
666 This works because the dummy definition of :func:`_` simply returns the string
674 is not a string literal.
690 In this case, you are marking translatable strings with the function