VirtualMailManager/Account.py
changeset 32 ceb700bc4a80
parent 24 48ea255e8a85
child 34 6d74e20c5b3b
--- a/VirtualMailManager/Account.py	Sat May 10 02:56:33 2008 +0000
+++ b/VirtualMailManager/Account.py	Tue May 13 03:20:02 2008 +0000
@@ -13,12 +13,18 @@
 __revision__ = 'rev '+'$Rev$'.split()[1]
 __date__ = '$Date$'.split()[1]
 
+import gettext
+
 from Exceptions import VMMAccountException
 from Domain import Domain
 from Transport import Transport
 from MailLocation import MailLocation
 import constants.ERROR as ERR
 
+gettext.bindtextdomain('vmm', '/usr/local/share/locale')
+gettext.textdomain('vmm')
+_ = gettext.gettext
+
 class Account:
     """Class to manage e-mail accounts."""
     def __init__(self, dbh, address, password=None):
@@ -36,7 +42,7 @@
         self._exists()
         if self._isAlias():
             raise VMMAccountException(
-            ('There is already an alias with address »%s«' % address,
+            (_('There is already an alias with address »%s«') % address,
                 ERR.ALIAS_EXISTS))
 
     def _exists(self):
@@ -68,8 +74,9 @@
         dom = Domain(self._dbh, d)
         self._gid = dom.getID()
         if self._gid == 0:
-            raise VMMAccountException(("Domain »%s« doesn't exist." % d,
-                ERR.NO_SUCH_DOMAIN))
+            #raise VMMAccountException(("Domain »%s« doesn't exist." % d,
+            errmsg = _('Domain »%s« does not exists.')
+            raise VMMAccountException((errmsg % d, ERR.NO_SUCH_DOMAIN))
         self._base = dom.getDir()
         self._tid = dom.getTransportID()