From 16c00d2037cde6da07b4988dbd35ebce0af56791 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 17 Jul 2009 17:15:38 +0200 Subject: apt/__init__.py, apt/__cache__.py: Improve python-apt localization. --- apt/__init__.py | 6 +++--- apt/cache.py | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apt/__init__.py b/apt/__init__.py index ec7103a1..2ef8add3 100644 --- a/apt/__init__.py +++ b/apt/__init__.py @@ -18,6 +18,8 @@ # USA # import the core of apt_pkg """High-Level Interface for working with apt.""" +import locale + import apt_pkg # import some fancy classes @@ -28,15 +30,13 @@ from apt.cdrom import Cdrom if apt_pkg._COMPAT_0_7: from apt.progress.old import (OpProgress, FetchProgress, InstallProgress, CdromProgress) - -if apt_pkg._COMPAT_0_7: 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) diff --git a/apt/cache.py b/apt/cache.py index a93d5575..6e11d215 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -21,6 +21,7 @@ import os import weakref +from gettext import dgettext import apt_pkg from apt import Package @@ -29,6 +30,10 @@ from apt.deprecation import (AttributeDeprecatedBy, function_deprecated_by, 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.""" @@ -92,7 +97,7 @@ class Cache(object): self._set.clear() self._weakref.clear() - progress.op = "Building data structures" + progress.op = _("Building data structures") i=last=0 size=len(self._cache.packages) for pkg in self._cache.packages: -- cgit v1.2.3