Author: jmorliaguet
Date: Mon Jun  5 16:55:28 2006
New Revision: 3318

Added:
   cpsskins/branches/paris-sprint-2006/configuration/i18n/
   cpsskins/branches/paris-sprint-2006/configuration/i18n/__init__.py   
(contents, props changed)
   cpsskins/branches/paris-sprint-2006/configuration/i18n/meta.zcml   
(contents, props changed)
   cpsskins/branches/paris-sprint-2006/configuration/i18n/metaconfigure.py   
(contents, props changed)
   cpsskins/branches/paris-sprint-2006/configuration/i18n/metadirectives.py   
(contents, props changed)
Modified:
   cpsskins/branches/paris-sprint-2006/configuration/configure.zcml
   cpsskins/branches/paris-sprint-2006/configuration/meta.zcml

Log:

- saving work: initial code to merge translations into an existing domain



Modified: cpsskins/branches/paris-sprint-2006/configuration/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/configuration/configure.zcml    
(original)
+++ cpsskins/branches/paris-sprint-2006/configuration/configure.zcml    Mon Jun 
 5 16:55:28 2006
@@ -1,5 +1,7 @@
 <configure>
 
+  <include package=".i18n" />
+
   <include package=".engines" />
 
 </configure>

Added: cpsskins/branches/paris-sprint-2006/configuration/i18n/__init__.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/i18n/__init__.py  Mon Jun 
 5 16:55:28 2006
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+

Added: cpsskins/branches/paris-sprint-2006/configuration/i18n/meta.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/i18n/meta.zcml    Mon Jun 
 5 16:55:28 2006
@@ -0,0 +1,16 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:meta="http://namespaces.zope.org/meta";
+    >
+
+  <meta:directives namespace="http://namespaces.zope.org/cpsskins";>
+
+    <meta:directive
+        name="mergeTranslations"
+        schema=".metadirectives.IMergeTranslationsDirective"
+        handler=".metaconfigure.mergeTranslations"
+        />
+
+  </meta:directives>
+
+</configure>

Added: cpsskins/branches/paris-sprint-2006/configuration/i18n/metaconfigure.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/i18n/metaconfigure.py     
Mon Jun  5 16:55:28 2006
@@ -0,0 +1,43 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import os
+
+from zope.component import getGlobalSiteManager
+from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
+from zope.i18n.testmessagecatalog import TestMessageCatalog
+from zope.i18n.translationdomain import TranslationDomain
+from zope.i18n.interfaces import ITranslationDomain
+
+merge_list = []
+
+def bootstrapSubscriber(event):
+    gsm = getGlobalSiteManager()
+    for info in merge_list:
+        domain = gsm.getUtility(ITranslationDomain, name=info['domain'])
+        directory = info['directory']
+        path = os.path.normpath(directory)
+        # TODO
+
+def mergeTranslations(_context, directory, domain=u''):
+    if not domain:
+        raise ConfigurationError("Must specify a domain name")
+
+    merge_list.append({'domain': domain, 'directory': directory})
+

Added: cpsskins/branches/paris-sprint-2006/configuration/i18n/metadirectives.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/i18n/metadirectives.py    
Mon Jun  5 16:55:28 2006
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.configuration.fields import Path
+from zope.interface import Interface
+from zope.schema import TextLine
+
+class IMergeTranslationsDirective(Interface):
+    """Merge translations into an existing domain."""
+
+    domain = TextLine(
+        title=u"Domain name",
+        description=u"The domain into which translations will be added",
+        required=True)
+
+    directory = Path(
+        title=u"Directory",
+        description=u"Directory containing the translations",
+        required=True)
+

Modified: cpsskins/branches/paris-sprint-2006/configuration/meta.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/configuration/meta.zcml (original)
+++ cpsskins/branches/paris-sprint-2006/configuration/meta.zcml Mon Jun  5 
16:55:28 2006
@@ -1,5 +1,7 @@
 <configure xmlns="http://namespaces.zope.org/zope";>
 
+  <include package=".i18n" file="meta.zcml" />
+
   <include package=".portlets" file="meta.zcml" />
 
   <include package=".filters" file="meta.zcml" />
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to