[Erp5-report] r23232 - in /erp5/trunk/products/ERP5: Constraint/ Extensions/ Tool/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Aug 28 15:30:12 CEST 2008
Author: yusei
Date: Thu Aug 28 15:30:05 2008
New Revision: 23232
URL: http://svn.erp5.org?rev=23232&view=rev
Log:
Use translateString instead of N_.
Modified:
erp5/trunk/products/ERP5/Constraint/AccountTypeConstraint.py
erp5/trunk/products/ERP5/Constraint/AccountingTransactionBalance.py
erp5/trunk/products/ERP5/Constraint/DocumentReferenceConstraint.py
erp5/trunk/products/ERP5/Extensions/InventoryBrain.py
erp5/trunk/products/ERP5/Tool/PasswordTool.py
erp5/trunk/products/ERP5/Tool/TemplateTool.py
Modified: erp5/trunk/products/ERP5/Constraint/AccountTypeConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Constraint/AccountTypeConstraint.py?rev=23232&r1=23231&r2=23232&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Constraint/AccountTypeConstraint.py (original)
+++ erp5/trunk/products/ERP5/Constraint/AccountTypeConstraint.py Thu Aug 28 15:30:05 2008
@@ -28,7 +28,7 @@
from Products.ERP5Type.Constraint import Constraint
from Products.ERP5Type.Message import Message
-N_ = lambda msg: msg # just to extract messages
+translateString = lambda msg: msg # just to extract messages
_MARKER = []
class AccountTypeConstraint(Constraint):
@@ -53,17 +53,19 @@
_message_id_list = ['message_inconsistent_account_type']
- message_inconsistent_account_type = N_('Account is member'\
- ' of ${category}, this should have account_type'\
- ' in ${account_type_list}')
+ message_inconsistent_account_type = translateString(
+ 'Account is member'
+ ' of ${category}, this should have account_type'
+ ' in ${account_type_list}')
def checkConsistency(self, obj, fixit=0):
"""Implement here the consistency checker
"""
errors = []
if getattr(obj, 'getAccountType', _MARKER) is _MARKER:
- errors.append(self._generateError(obj,
- N_("Account doesn't have account_type category")))
+ errors.append(self._generateError(
+ obj,
+ translateString("Account doesn't have account_type category")))
else:
account_type_map = getattr(self, '_account_type_map', ())
if not account_type_map:
Modified: erp5/trunk/products/ERP5/Constraint/AccountingTransactionBalance.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Constraint/AccountingTransactionBalance.py?rev=23232&r1=23231&r2=23232&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Constraint/AccountingTransactionBalance.py (original)
+++ erp5/trunk/products/ERP5/Constraint/AccountingTransactionBalance.py Thu Aug 28 15:30:05 2008
@@ -28,7 +28,7 @@
from Products.ERP5Type.Constraint import Constraint
from Products.ERP5Type.Message import Message
-N_ = lambda msg: msg # just to extract messages
+translateString = lambda msg: msg # just to extract messages
class AccountingTransactionBalance(Constraint):
"""Check that accounting transaction total debit and total credit are equals.
@@ -37,9 +37,9 @@
_message_id_list = [ 'message_transaction_not_balanced_for_source',
'message_transaction_not_balanced_for_destination' ]
- message_transaction_not_balanced_for_source = N_(
+ message_transaction_not_balanced_for_source = translateString(
'Transaction is not Balanced')
- message_transaction_not_balanced_for_destination = N_(
+ message_transaction_not_balanced_for_destination = translateString(
'Transaction is not Balanced')
def checkConsistency(self, obj, fixit=0):
Modified: erp5/trunk/products/ERP5/Constraint/DocumentReferenceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Constraint/DocumentReferenceConstraint.py?rev=23232&r1=23231&r2=23232&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Constraint/DocumentReferenceConstraint.py (original)
+++ erp5/trunk/products/ERP5/Constraint/DocumentReferenceConstraint.py Thu Aug 28 15:30:05 2008
@@ -27,7 +27,7 @@
##############################################################################
from Products.ERP5Type.Constraint import Constraint
-N_ = lambda msg, **kw: msg # just to extract messages
+translateString = lambda msg, **kw: msg # just to extract messages
_MARKER = []
@@ -45,12 +45,12 @@
'message_another_document_exists',
'message_multiple_documents_exists' ]
- message_property_not_defined = N_(
+ message_property_not_defined = translateString(
'Property ${property_id} was not defined')
- message_another_document_exists = N_(
+ message_another_document_exists = translateString(
'Another document ${document_reference} - '
'${document_language} - ${document_version} already exists')
- message_multiple_documents_exists = N_(
+ message_multiple_documents_exists = translateString(
'Multiple (${document_count}) documents ${document_reference} - '
'${document_language} - ${document_version} already exists')
Modified: erp5/trunk/products/ERP5/Extensions/InventoryBrain.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Extensions/InventoryBrain.py?rev=23232&r1=23231&r2=23232&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Extensions/InventoryBrain.py (original)
+++ erp5/trunk/products/ERP5/Extensions/InventoryBrain.py Thu Aug 28 15:30:05 2008
@@ -16,6 +16,7 @@
from ZTUtils import make_query
from Products.CMFCore.utils import getToolByName
from zLOG import LOG, PROBLEM
+from Products.ERP5Type.Message import translateString
class InventoryBrain(ZSQLBrain):
"""
@@ -260,7 +261,6 @@
# Returns an explanation of the movement
o = self.getObject()
if o is not None:
- N_ = lambda msg, **kw: o.Localizer.translate('ui', msg, **kw)
# Get the delivery/order
if not getattr(o, 'isDelivery', 0):
delivery = o.getExplanationValue()
@@ -275,16 +275,16 @@
}
causality = delivery.getCausalityValue()
if causality is not None:
- mapping['causality_portal_type'] = \
- causality.getTranslatedPortalType()
+ mapping['causality_portal_type'] = causality.getTranslatedPortalType()
mapping['causality_title'] = causality.getTitleOrId()
- return N_("${delivery_portal_type} ${delivery_title} "\
- "(${causality_portal_type} ${causality_title})",
- mapping = mapping )
+ return translateString(
+ "${delivery_portal_type} ${delivery_title} "
+ "(${causality_portal_type} ${causality_title})",
+ mapping=mapping)
else :
- return N_("${delivery_portal_type} ${delivery_title}",
- mapping = mapping )
- return N_('Unknown')
+ return translateString("${delivery_portal_type} ${delivery_title}",
+ mapping=mapping)
+ return translateString('Unknown')
class TrackingListBrain(InventoryListBrain):
"""
Modified: erp5/trunk/products/ERP5/Tool/PasswordTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/PasswordTool.py?rev=23232&r1=23231&r2=23232&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/PasswordTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/PasswordTool.py Thu Aug 28 15:30:05 2008
@@ -35,10 +35,10 @@
from zLOG import LOG
import time, random, md5
from DateTime import DateTime
-from Products.ERP5Type.Message import Message
+from Products.ERP5Type.Message import translateString
from Acquisition import aq_base
from BTrees.OOBTree import OOBTree
-N_ = lambda msgid, **kw: Message('ui', msgid, **kw)
+
class PasswordTool(BaseTool):
"""
@@ -73,8 +73,8 @@
# check user exists
user_list = self.portal_catalog.unrestrictedSearchResults(portal_type="Person", reference=user_login)
if len(user_list) == 0:
- msg = N_("User ${user} doesn't exist.",
- mapping={'user': user_login})
+ msg = translateString("User ${user} doesn't exist.",
+ mapping={'user':user_login})
if REQUEST is not None:
ret_url = '%s/login_form?portal_status_message=%s' % \
(self.getPortalObject().absolute_url(),msg)
@@ -101,7 +101,7 @@
"Thank you" %(self.getPortalObject().getTitle(), url, expiration_date)
self.portal_notifications.sendMessage(sender=None, recipient=[user,], subject=subject, message=message)
if REQUEST is not None:
- msg = N_("An email has been sent to you.")
+ msg = translateString("An email has been sent to you.")
ret_url = '%s/login_form?portal_status_message=%s' % \
(self.getPortalObject().absolute_url(),msg)
return REQUEST.RESPONSE.redirect( ret_url )
@@ -140,7 +140,7 @@
# check date
current_date = DateTime()
if current_date > expiration_date:
- msg = N_("Date has expire.",)
+ msg = translateString("Date has expire.")
ret_url = '%s/login_form?portal_status_message=%s' % \
(self.getPortalObject().absolute_url(), msg)
return REQUEST.RESPONSE.redirect( ret_url )
@@ -172,11 +172,11 @@
if register_user_login is None:
msg = ""
elif register_user_login != user_login:
- msg = N_("Bad login provided.",)
+ msg = translateString("Bad login provided.")
elif current_date > expiration_date:
- msg = N_("Date has expire.",)
+ msg = translateString("Date has expire.")
elif password != password_confirmation:
- msg = N_("Password are not identical.",)
+ msg = translateString("Password are not identical.")
if msg is not None:
if REQUEST is not None:
ret_url = '%s/login_form?portal_status_message=%s' % \
@@ -192,7 +192,7 @@
person._setPassword(password)
person.reindexObject()
if REQUEST is not None:
- msg = N_("Password changed.",)
+ msg = translateString("Password changed.")
ret_url = '%s/login_form?portal_status_message=%s' % \
(self.getPortalObject().absolute_url(), msg)
return REQUEST.RESPONSE.redirect( ret_url )
Modified: erp5/trunk/products/ERP5/Tool/TemplateTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TemplateTool.py?rev=23232&r1=23231&r2=23232&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TemplateTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/TemplateTool.py Thu Aug 28 15:30:05 2008
@@ -51,10 +51,9 @@
from base64 import b64encode, b64decode
except ImportError:
from base64 import encodestring as b64encode, decodestring as b64decode
-from Products.ERP5Type.Message import Message
+from Products.ERP5Type.Message import translateString
from zLOG import LOG, INFO
-N_ = lambda msgid, **kw: Message('ui', msgid, **kw)
WIN = os.name == 'nt'
@@ -162,8 +161,8 @@
path = pathname2url(path)
business_template.export(path=path, local=1)
if REQUEST is not None:
- psm = N_('Saved+in+${path}+.',
- mapping={'path': pathname2url(path)})
+ psm = translateString('Saved+in+${path}+.',
+ mapping={'path':pathname2url(path)})
ret_url = '%s/%s?portal_status_message=%s' % \
(business_template.absolute_url(),
REQUEST.get('form_id', 'view'), psm)
@@ -283,7 +282,7 @@
if REQUEST is not None:
ret_url = bt.absolute_url() + '/view'
- psm = N_("Business+Template+Downloaded+Successfully")
+ psm = translateString("Business+Template+Downloaded+Successfully")
REQUEST.RESPONSE.redirect("%s?portal_status_message=%s"
% (ret_url, psm))
@@ -398,7 +397,7 @@
if (import_file is None) or (len(import_file.read()) == 0):
if REQUEST is not None:
- psm = N_('No+file+or+an+empty+file+was+specified')
+ psm = translateString('No+file+or+an+empty+file+was+specified')
REQUEST.RESPONSE.redirect("%s?portal_status_message=%s"
% (self.absolute_url(), psm))
return
@@ -423,7 +422,7 @@
if (batch_mode == 0) and \
(REQUEST is not None):
ret_url = bt.absolute_url() + '/view'
- psm = N_("Business+Templates+Imported+Successfully")
+ psm = translateString("Business+Templates+Imported+Successfully")
REQUEST.RESPONSE.redirect("%s?portal_status_message=%s"
% (ret_url, psm))
elif (batch_mode == 1):
@@ -542,7 +541,7 @@
if REQUEST is not None:
ret_url = self.absolute_url() + '/' + REQUEST.get('dialog_id', 'view')
- psm = N_("Business+Templates+Updated+Successfully")
+ psm = translateString("Business+Templates+Updated+Successfully")
REQUEST.RESPONSE.redirect("%s?cancel_url=%s&portal_status_message=%s&dialog_category=object_exchange&selection_name=business_template_selection"
% (ret_url, REQUEST.form.get('cancel_url', ''), psm))
More information about the Erp5-report
mailing list