[Zope3-checkins] CVS: Zope3/src/zope/app/services/translation - gettextexportfilter.py:1.1.2.3 gettextimportfilter.py:1.1.2.3 messagecatalog.py:1.1.2.3 translationservice.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:51 -0500
Update of /cvs-repository/Zope3/src/zope/app/services/translation
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/services/translation
Modified Files:
Tag: NameGeddon-branch
gettextexportfilter.py gettextimportfilter.py
messagecatalog.py translationservice.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/services/translation/gettextexportfilter.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/translation/gettextexportfilter.py:1.1.2.2 Tue Dec 24 07:51:19 2002
+++ Zope3/src/zope/app/services/translation/gettextexportfilter.py Tue Dec 24 21:20:50 2002
@@ -2,16 +2,16 @@
#
# Copyright (c) 2001, 2002 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.
-#
+#
##############################################################################
-"""Translation Service Message Export Filter
+"""Translation Service Message Export Filter
$Id$
"""
@@ -64,7 +64,7 @@
msgid = msgid.encode('UTF-8')
output += _msg_template %(msgid, msgstr)
- return output
+ return output
#
############################################################
@@ -78,7 +78,7 @@
"PO-Revision-Date: %s\\n"
"Last-Translator: Zope 3 Gettext Export Filter\\n"
"Zope-Language: %s\\n"
-"Zope-Domain: %s\\n"
+"Zope-Domain: %s\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
=== Zope3/src/zope/app/services/translation/gettextimportfilter.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/translation/gettextimportfilter.py:1.1.2.2 Tue Dec 24 07:51:19 2002
+++ Zope3/src/zope/app/services/translation/gettextimportfilter.py Tue Dec 24 21:20:50 2002
@@ -2,16 +2,16 @@
#
# Copyright (c) 2001, 2002 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.
-#
+#
##############################################################################
-"""Translation Service Message Import Filter
+"""Translation Service Message Import Filter
$Id$
"""
@@ -85,8 +85,8 @@
# The regular expressions
com = re.compile('^#.*')
msgid = re.compile(r'^ *msgid *"(.*?[^\\]*)"')
- msgstr = re.compile(r'^ *msgstr *"(.*?[^\\]*)"')
- re_str = re.compile(r'^ *"(.*?[^\\])"')
+ msgstr = re.compile(r'^ *msgstr *"(.*?[^\\]*)"')
+ re_str = re.compile(r'^ *"(.*?[^\\])"')
blank = re.compile(r'^\s*$')
trans = {}
=== Zope3/src/zope/app/services/translation/messagecatalog.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/translation/messagecatalog.py:1.1.2.2 Tue Dec 24 07:51:19 2002
+++ Zope3/src/zope/app/services/translation/messagecatalog.py Tue Dec 24 21:20:50 2002
@@ -2,16 +2,16 @@
#
# Copyright (c) 2001, 2002 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.
-#
+#
##############################################################################
-"""A simple implementation of a Message Catalog.
+"""A simple implementation of a Message Catalog.
$Id$
"""
@@ -36,7 +36,7 @@
self._language = language
self._domain = domain
self._messages = OOBTree()
-
+
def getMessage(self, id):
'See IReadMessageCatalog'
return removeAllProxies(self._messages[id][0])
@@ -53,7 +53,7 @@
def getLanguage(self):
'See IReadMessageCatalog'
return self._language
-
+
def getDomain(self):
'See IReadMessageCatalog'
return self._domain
@@ -76,7 +76,7 @@
if mod_time is None:
mod_time = int(time.time())
self._messages[msgid] = (message, mod_time)
-
+
def deleteMessage(self, msgid):
'See IWriteMessageCatalog'
del self._messages[msgid]
=== Zope3/src/zope/app/services/translation/translationservice.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/services/translation/translationservice.py:1.1.2.2 Tue Dec 24 07:51:19 2002
+++ Zope3/src/zope/app/services/translation/translationservice.py Tue Dec 24 21:20:50 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 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.
-#
+#
##############################################################################
"""This is the standard, placeful Translation Service for TTW development.
@@ -74,7 +74,7 @@
self._unregisterMessageCatalog(object.getLanguage(),
object.getDomain(), name)
- def translate(self, domain, msgid, mapping=None, context=None,
+ def translate(self, domain, msgid, mapping=None, context=None,
target_language=None):
"""See interface ITranslationService"""
if domain is None:
@@ -109,12 +109,12 @@
# Now we need to do the interpolation
return self.interpolate(text, mapping)
-
+
def getMessageIdsOfDomain(self, domain, filter='%'):
'See IWriteTranslationService'
filter = filter.replace('%', '.*')
filter_re = re.compile(filter)
-
+
msgids = {}
languages = self.getAvailableLanguages(domain)
for language in languages:
@@ -174,7 +174,7 @@
identifiers = filter(lambda x, l=language: x[0] == l, identifiers)
domains = map(lambda x: x[1], identifiers)
return domains
-
+
def addMessage(self, domain, msgid, msg, language, mod_time=None):
'See IWriteTranslationService'
@@ -183,7 +183,7 @@
self.addLanguage(language)
if domain not in self.getAllDomains():
self.addDomain(domain)
-
+
catalog_name = self._catalogs[(language, domain)][0]
catalog = self[catalog_name]
catalog.setMessage(msgid, msg, mod_time)
@@ -261,10 +261,10 @@
for fmsg in foreign_messages:
ident = (fmsg['msgid'], fmsg['domain'], fmsg['language'])
mapping[ident] = (fmsg, self.getMessage(*ident))
-
+
for lmsg in local_messages:
ident = (lmsg['msgid'], lmsg['domain'], lmsg['language'])
- if ident not in mapping.keys():
+ if ident not in mapping.keys():
mapping[ident] = (None, lmsg)
return mapping