[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n - IMessageCatalog.py:1.1.2.1

Jim Fulton jim@zope.com
Sat, 19 Jan 2002 09:26:36 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/I18n
In directory cvs.zope.org:/tmp/cvs-serv26926

Added Files:
      Tag: Zope-3x-branch
	IMessageCatalog.py 
Log Message:
Provide simpler (than ITranslationService) to be implemented by
message catalogs, which will be used by translation services.



=== Added File Zope3/lib/python/Zope/I18n/IMessageCatalog.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""
Revision information: $Id: IMessageCatalog.py,v 1.1.2.1 2002/01/19 14:26:35 jim Exp $
"""

from Interface import Interface


class ITranslationService(Interface):
    """Translation Service

    This interface provides methods for translating text, including
    text with interpolation.

    When we refer to text here, we mean text that follows the standard
    Zope 3 text representation (tbd).

    Standard arguments:

        destination_language_tag -- The language tag of the langauge
                                    to translate to.

        context -- An object that provides contextual information for
                   determining client language preferences. It must
                   implement or have an adapter that implements
                   IUserPreferedLanguages.

        Note that one of destination_language or context must be
        passed. Otherwise a TypeError will be raised.

        Also note that languages tags are defined by RFC 1766.

        domain -- The domain can be used to request spcialized
                  translations, for example for a specific product or
                  topic like dbobjects or calendaring.
    """

    def getTranslation(message_id,
                       context=None,
                       destination_language_tag=None,
                       domain=None):
        """Get the translation for a translation id

        The message id provide a language-independent identifier for a
        message. 

        A sequence is returned including translated text and IVariable
        objects. 
        """

    def translateSequence(source_sequence,
                          context=None,
                          source_language_tag=None,
                          destination_language_tag=None,
                          domain=None):
        """Translate a source sequence that represents text with interpolation

        The source sequence is a sequence of text and IVariable
        object. The IVariable objects define interpolation names for
        data to be interpolated during or after translation.

        The source language tag is either specified here or uses the
        default defined by the service.

        A sequence is returned including translated text and IVariable
        objects. 
        """