Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13259/Doc/lib Modified Files: libgettext.tex Log Message: Add a per-message fallback mechanism for translations. Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libgettext.tex 2002/01/11 06:33:27 1.10 --- libgettext.tex 2002/01/11 06:58:49 1.11 *************** *** 96,100 **** namespace as the function \function{_()}. ! \begin{funcdesc}{find}{domain\optional{, localedir\optional{, languages}}} This function implements the standard \file{.mo} file search algorithm. It takes a \var{domain}, identical to what --- 96,101 ---- namespace as the function \function{_()}. ! \begin{funcdesc}{find}{domain\optional{, localedir\optional{, ! languages\optional{, all}}}} This function implements the standard \file{.mo} file search algorithm. It takes a \var{domain}, identical to what *************** *** 120,124 **** The first such file name that exists is returned by \function{find()}. ! If no such file is found, then \code{None} is returned. \end{funcdesc} --- 121,127 ---- The first such file name that exists is returned by \function{find()}. ! If no such file is found, then \code{None} is returned. If \var{all} ! is given, it returns a list of all file names, in the order in which ! they appear in the languages list or the environment variables. \end{funcdesc} *************** *** 128,140 **** Return a \class{Translations} instance based on the \var{domain}, \var{localedir}, and \var{languages}, which are first passed to ! \function{find()} to get the ! associated \file{.mo} file path. Instances with identical \file{.mo} file names are cached. The actual class instantiated is either \var{class_} if provided, otherwise \class{GNUTranslations}. The class's constructor must take a single ! file object argument. If no \file{.mo} file is found, this ! function raises \exception{IOError} if \var{fallback} is false ! (which is the default), and returns a \class{NullTranslations} instance ! if \var{fallback} is true. \end{funcdesc} --- 131,150 ---- Return a \class{Translations} instance based on the \var{domain}, \var{localedir}, and \var{languages}, which are first passed to ! \function{find()} to get a list of the ! associated \file{.mo} file paths. Instances with identical \file{.mo} file names are cached. The actual class instantiated is either \var{class_} if provided, otherwise \class{GNUTranslations}. The class's constructor must take a single ! file object argument. ! ! If multiple files are found, later files are used as fallbacks for ! earlier ones. To allow setting the fallback, \function{copy.copy} ! is used to clone each translation object from the cache; the actual ! instance data is still shared with the cache. ! ! If no \file{.mo} file is found, this function raises ! \exception{IOError} if \var{fallback} is false (which is the default), ! and returns a \class{NullTranslations} instance if \var{fallback} is ! true. \end{funcdesc} *************** *** 169,173 **** Takes an optional file object \var{fp}, which is ignored by the base class. Initializes ``protected'' instance variables \var{_info} and ! \var{_charset} which are set by derived classes. It then calls \code{self._parse(fp)} if \var{fp} is not \code{None}. \end{methoddesc} --- 179,184 ---- Takes an optional file object \var{fp}, which is ignored by the base class. Initializes ``protected'' instance variables \var{_info} and ! \var{_charset} which are set by derived classes, as well as \var{_fallback}, ! which is set through \method{add_fallback}. It then calls \code{self._parse(fp)} if \var{fp} is not \code{None}. \end{methoddesc} *************** *** 180,190 **** \end{methoddesc} \begin{methoddesc}[NullTranslations]{gettext}{message} ! Return the translated message. Overridden in derived classes. \end{methoddesc} \begin{methoddesc}[NullTranslations]{ugettext}{message} ! Return the translated message as a Unicode string. Overridden in ! derived classes. \end{methoddesc} --- 191,209 ---- \end{methoddesc} + \begin{methoddesc}{NullTranslations}{add_fallback}{fallback} + Add \var{fallback} as the fallback object for the current translation + object. A translation object should consult the fallback if it cannot + provide a translation for a given message. + \end{methoddesc} + \begin{methoddesc}[NullTranslations]{gettext}{message} ! If a fallback has been set, forward \method{gettext} to the fallback. ! Otherwise, return the translated message. Overridden in derived classes. \end{methoddesc} \begin{methoddesc}[NullTranslations]{ugettext}{message} ! If a fallback has been set, forward \method{ugettext} to the fallback. ! Otherwise, return the translated message as a Unicode string. ! Overridden in derived classes. \end{methoddesc}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4