[Zope3-checkins] SVN: Zope3/trunk/src/zope/i18n Merge the philikon-messages-as-rocks branch to the trunk. It is an implementation

Philipp von Weitershausen philikon at philikon.de
Wed Sep 22 14:59:42 EDT 2004


Log message for revision 27645:
  Merge the philikon-messages-as-rocks branch to the trunk.  It is an implementation
  of the TurningMessageIDsIntoRocks proposal.
  
   Two things of that proposal were modified during the implementation:
    - message ids are now simply called Messages (first, because of simplicity,
      2nd because of differentiation to the old message ids)
    - the % operator for filling the message id mapping was not realized
      because it breaks the rule that messages behave like (unicode) strings
      in all circumstances.
  


Changed:
  D   Zope3/trunk/src/zope/i18n/message_id.txt
  _U  Zope3/trunk/src/zope/i18nmessageid/
  U   Zope3/trunk/src/zope/i18nmessageid/__init__.py
  A   Zope3/trunk/src/zope/i18nmessageid/_zope_i18nmessageid_message.c
  A   Zope3/trunk/src/zope/i18nmessageid/message.py
  A   Zope3/trunk/src/zope/i18nmessageid/messages.txt
  U   Zope3/trunk/src/zope/i18nmessageid/tests.py


-=-
Deleted: Zope3/trunk/src/zope/i18n/message_id.txt
===================================================================
--- Zope3/trunk/src/zope/i18n/message_id.txt	2004-09-22 18:37:25 UTC (rev 27644)
+++ Zope3/trunk/src/zope/i18n/message_id.txt	2004-09-22 18:59:35 UTC (rev 27645)
@@ -1,49 +0,0 @@
-=================
-Translatable Text
-=================
-
-Rationale
----------
-
-To translate any text, we must be able to discover the source
-domain of the text. A source domain is an identifier that identifies a
-project that produces program source strings. Source strings include
-literals in python programs, text in templates, and some text in XML
-data. The project implies a source language and an application
-context.
-
-We can think of a source domain as a collection of message IDs
-and associated translation strings.
-
-We often need to create strings that will be displayed by separate
-views. The view cannot translate the string without knowing its source
-domain. A string literal carries no domain information, so we use
-message IDs. Message IDs are strings which carry a translation source
-domain. These are created by a message ID factory. The message ID
-factory is created by calling zope.i18n.messageIDFactory with the
-source domain::
-
-  from zope import i18n
-  _ = i18n.MessageIDFactory("mydomain")
-
-  class IContact(Interface):
-      "Provides access to basic contact information."
-
-      first = TextLine(title=_(u"First name"))
-      last = TextLine(title=_(u"Last name"))
-      email = TextLine(title=_(u"Electronic mail address"))
-      address = Text(title=_(u"Postal address"))
-      postal_code = TextLine(title=_(u"Postal code"),
-			    constraint=re.compile("\d{5,5}(-\d{4,4})?$").match)
-
-      def name():
-	  """Gets the contact name.
-
-	  The contact name is the first and last name."""
-
-In this example, we create a message ID factory and assign it to
-_. By convention, we use _ as the name of our factory to be compatible
-with translatable string extraction tools such as xgettext. We then
-call _ with each string that needs to be translatable.  The resulting
-message IDs can be used by a translation service.
-


Property changes on: Zope3/trunk/src/zope/i18nmessageid
___________________________________________________________________
Name: svn:ignore
   + *.so


Modified: Zope3/trunk/src/zope/i18nmessageid/__init__.py
===================================================================
--- Zope3/trunk/src/zope/i18nmessageid/__init__.py	2004-09-22 18:37:25 UTC (rev 27644)
+++ Zope3/trunk/src/zope/i18nmessageid/__init__.py	2004-09-22 18:59:35 UTC (rev 27645)
@@ -11,5 +11,9 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"$Id$"
+"""I18n Messages
+
+$Id$
+"""
 from messageid import MessageID, MessageIDFactory
+from message import Message, MessageFactory

Copied: Zope3/trunk/src/zope/i18nmessageid/_zope_i18nmessageid_message.c (from rev 27644, Zope3/branches/philikon-messages-as-rocks/src/zope/i18nmessageid/_zope_i18nmessageid_message.c)


Property changes on: Zope3/trunk/src/zope/i18nmessageid/_zope_i18nmessageid_message.c
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: Zope3/trunk/src/zope/i18nmessageid/message.py (from rev 27644, Zope3/branches/philikon-messages-as-rocks/src/zope/i18nmessageid/message.py)


Property changes on: Zope3/trunk/src/zope/i18nmessageid/message.py
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: Zope3/trunk/src/zope/i18nmessageid/messages.txt (from rev 27644, Zope3/branches/philikon-messages-as-rocks/src/zope/i18nmessageid/messages.txt)


Property changes on: Zope3/trunk/src/zope/i18nmessageid/messages.txt
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.1
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/i18nmessageid/tests.py
===================================================================
--- Zope3/trunk/src/zope/i18nmessageid/tests.py	2004-09-22 18:37:25 UTC (rev 27644)
+++ Zope3/trunk/src/zope/i18nmessageid/tests.py	2004-09-22 18:59:35 UTC (rev 27645)
@@ -16,10 +16,13 @@
 $Id$
 """
 import unittest
-from zope.testing.doctestunit import DocTestSuite
+from zope.testing.doctestunit import DocTestSuite, DocFileSuite
 
 def test_suite():
-    return DocTestSuite('zope.i18nmessageid.messageid')
+    return unittest.TestSuite((
+	    DocTestSuite('zope.i18nmessageid.messageid'),
+	    DocFileSuite('messages.txt', package='zope.i18nmessageid'),
+	    ))
 
 if __name__ == '__main__':
     unittest.main(defaultTest="test_suite")



More information about the Zope3-Checkins mailing list