summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-17 19:06:20 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-17 19:06:20 +0200
commit9bd7c1dcf9942d6ce294aa5ac58d90d6c1aa9f51 (patch)
tree86beb8d7ddbee1602deb5ffa9f267ab8a06a1c8f
parent769c1d5fa940e70ddb8ac55e8dd5ed8f05ab7e6e (diff)
downloadpython-apt-9bd7c1dcf9942d6ce294aa5ac58d90d6c1aa9f51.tar.gz
apt: Use apt_pkg.gettext instead of Python's gettext.
-rw-r--r--apt/__init__.py9
-rw-r--r--apt/cache.py6
-rw-r--r--apt/debfile.py2
-rw-r--r--apt/package.py7
-rw-r--r--apt/progress/gtk2.py2
-rw-r--r--apt/progress/text.py6
6 files changed, 7 insertions, 25 deletions
diff --git a/apt/__init__.py b/apt/__init__.py
index 2ef8add3..a75218a8 100644
--- a/apt/__init__.py
+++ b/apt/__init__.py
@@ -18,8 +18,6 @@
# USA
# import the core of apt_pkg
"""High-Level Interface for working with apt."""
-import locale
-
import apt_pkg
# import some fancy classes
@@ -30,15 +28,10 @@ from apt.cdrom import Cdrom
if apt_pkg._COMPAT_0_7:
from apt.progress.old import (OpProgress, FetchProgress, InstallProgress,
CdromProgress)
- from apt_pkg import (size_to_str as SizeToStr,
- time_to_str as TimeToStr,
+ from apt_pkg import (size_to_str as SizeToStr, time_to_str as TimeToStr,
version_compare as VersionCompare)
# init the package system
apt_pkg.init()
-locale.setlocale(locale.LC_ALL, '')
-#import warnings
-#warnings.warn("apt API not stable yet", FutureWarning)
-#del warnings
__all__ = ['Cache', 'Cdrom', 'Package']
diff --git a/apt/cache.py b/apt/cache.py
index 6e11d215..9982559b 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -21,19 +21,15 @@
import os
import weakref
-from gettext import dgettext
import apt_pkg
from apt import Package
+from apt_pkg import gettext as _
from apt.deprecation import (AttributeDeprecatedBy, function_deprecated_by,
deprecated_args)
import apt.progress.text
-def _(msg):
- return dgettext('python-apt', msg)
-
-
class FetchCancelledException(IOError):
"""Exception that is thrown when the user cancels a fetch operation."""
diff --git a/apt/debfile.py b/apt/debfile.py
index 84bbe3ab..e05233f4 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -17,12 +17,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""Classes for working with locally available Debian packages."""
-from gettext import gettext as _
import os
import sys
import apt_inst
import apt_pkg
+from apt_pkg import gettext as _
# Constants for comparing the local package file with the version in the cache
diff --git a/apt/package.py b/apt/package.py
index 491571c2..1307ca3e 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -19,7 +19,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""Functionality related to packages."""
-import gettext
import httplib
import os
import sys
@@ -36,6 +35,7 @@ except ImportError:
import apt_pkg
import apt.progress.text
+from apt_pkg import gettext as _
from apt.deprecation import (function_deprecated_by, AttributeDeprecatedBy,
deprecated_args)
@@ -43,11 +43,6 @@ __all__ = ('BaseDependency', 'Dependency', 'Origin', 'Package', 'Record',
'Version')
-def _(string):
- """Return the translation of the string."""
- return gettext.dgettext("python-apt", string)
-
-
def _file_is_same(path, size, md5):
"""Return ``True`` if the file is the same."""
if (os.path.exists(path) and os.path.getsize(path) == size and
diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py
index c0f9ed82..066271c6 100644
--- a/apt/progress/gtk2.py
+++ b/apt/progress/gtk2.py
@@ -22,7 +22,6 @@
# USA
"""GObject-powered progress classes and a GTK+ status widget."""
-from gettext import gettext as _
import os
import time
@@ -39,6 +38,7 @@ import vte
import apt.progress.old
import apt_pkg
+from apt_pkg import gettext as _
from apt.deprecation import function_deprecated_by
diff --git a/apt/progress/text.py b/apt/progress/text.py
index ba8e158d..b93a8e81 100644
--- a/apt/progress/text.py
+++ b/apt/progress/text.py
@@ -16,7 +16,6 @@
# USA
"""Progress reporting for text interfaces."""
import sys
-from gettext import dgettext
import apt_pkg
@@ -25,13 +24,12 @@ __all__ = ['AcquireProgress', 'OpProgress']
def _(msg):
"""Translate the message, also try apt if translation is missing."""
- res = dgettext("python-apt", msg)
+ res = apt_pkg.gettext(msg)
if res == msg:
- return dgettext("apt", msg)
+ return apt_pkg.gettext(msg, "apt")
else:
return res
-
class TextProgress(object):
"""Internal Base class for text progress classes."""