[i18n] use ngettext in some places where it's most useful
This commit is contained in:
+21
-15
@@ -17,7 +17,7 @@ from entropy.output import darkgreen, darkred, red, blue, \
|
||||
print_warning, teal
|
||||
from entropy.exceptions import DependenciesNotRemovable
|
||||
from entropy.misc import Lifo
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.cli import show_dependencies_legend, print_package_info, \
|
||||
graph_packages, revgraph_packages
|
||||
import entropy.dep
|
||||
@@ -239,7 +239,7 @@ def search_repository_packages(packages, entropy_client, entropy_repository):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(package)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(pkg_ids), brown(_("entries")),)))
|
||||
len(pkg_ids), brown(P_("entry", "entries", len(pkg_ids))),)))
|
||||
print_table(toc)
|
||||
|
||||
if (not pkg_data) and (not etpUi['quiet']):
|
||||
@@ -305,7 +305,7 @@ def search_belongs(files, entropy_client, entropy_repository,
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(xfile)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(result), brown(_("entries")),)))
|
||||
len(result), brown(P_("entry", "entries", len(result))),)))
|
||||
print_table(toc)
|
||||
|
||||
return 0
|
||||
@@ -426,7 +426,8 @@ def search_reverse_dependencies(atoms, entropy_client, entropy_repository):
|
||||
where = _("from installed packages database")
|
||||
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s %s" % (
|
||||
len(search_results), brown(_("entries")), where,)))
|
||||
len(search_results),
|
||||
brown(P_("entry", "entries", len(search_results))), where,)))
|
||||
|
||||
print_table(toc)
|
||||
|
||||
@@ -489,7 +490,7 @@ def search_required_libraries(libraries, entropy_client, entropy_repository):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Library")),), purple(library)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(results), brown(_("packages")),)))
|
||||
len(results), brown(P_("package", "packages", len(results))),)))
|
||||
print_table(toc)
|
||||
|
||||
return 0
|
||||
@@ -766,7 +767,7 @@ def search_removal_dependencies(packages, entropy_client, entropy_repository,
|
||||
toc.append(("%s:" % (blue(_("Keywords")),),
|
||||
purple(', '.join(packages))))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
atomscounter, brown(_("entries")),)))
|
||||
atomscounter, brown(P_("entry", "entries", atomscounter)),)))
|
||||
print_table(toc)
|
||||
|
||||
return 0
|
||||
@@ -883,7 +884,8 @@ def search_package(packages, entropy_client, get_results = False,
|
||||
toc.append(("%s:" % (blue(_("Keywords")),),
|
||||
purple(', '.join(packages))))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(search_data), brown(_("entries")),)))
|
||||
len(search_data),
|
||||
brown(P_("entry", "entries", len(search_data))),)))
|
||||
print_table(toc)
|
||||
|
||||
return 0
|
||||
@@ -927,7 +929,7 @@ def search_mimetype(mimetypes, entropy_client, installed = False,
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(mimetype)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(matches), brown(_("entries")),)))
|
||||
len(matches), brown(P_("entry", "entries", len(matches))),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found:
|
||||
@@ -992,7 +994,8 @@ def match_package(packages, entropy_client, multi_match = False,
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(package)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(matches), brown(_("entries")),)))
|
||||
len(matches),
|
||||
brown(P_("entry", "entries", len(matches))),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found and not get_results:
|
||||
@@ -1036,7 +1039,8 @@ def search_slotted_packages(slots, entropy_client):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(slot)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(results), brown(_("entries")),)))
|
||||
len(results),
|
||||
brown(P_("entry", "entries", len(results))),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found:
|
||||
@@ -1077,7 +1081,7 @@ def search_package_sets(items, entropy_client):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(item)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
matchNumber, brown(_("entries")),)))
|
||||
matchNumber, brown(P_("entry", "entries", matchNumber)),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found:
|
||||
@@ -1116,7 +1120,8 @@ def search_tagged_packages(tags, entropy_client):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(tag)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(results), brown(_("entries")),)))
|
||||
len(results),
|
||||
brown(P_("entry", "entries", len(results))),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found:
|
||||
@@ -1146,7 +1151,7 @@ def search_rev_packages(revisions, entropy_client):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(revision)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(results), brown(_("entries")),)))
|
||||
len(results), brown(P_("entry", "entries", len(results))),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found:
|
||||
@@ -1190,7 +1195,8 @@ def search_licenses(licenses, entropy_client):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(mylicense)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(results), brown(_("entries")),)))
|
||||
len(results),
|
||||
brown(P_("entry", "entries", len(results))),)))
|
||||
print_table(toc)
|
||||
|
||||
if not etpUi['quiet'] and not found:
|
||||
@@ -1246,7 +1252,7 @@ def search_descriptions(descriptions, entropy_client, entropy_repository):
|
||||
toc = []
|
||||
toc.append(("%s:" % (blue(_("Keyword")),), purple(desc)))
|
||||
toc.append(("%s:" % (blue(_("Found")),), "%s %s" % (
|
||||
len(pkg_ids), brown(_("entries")),)))
|
||||
len(pkg_ids), brown(P_("entry", "entries", len(pkg_ids))),)))
|
||||
print_table(toc)
|
||||
|
||||
return found
|
||||
|
||||
+6
-7
@@ -30,7 +30,7 @@ from entropy.output import red, blue, brown, darkred, bold, darkgreen, bold, \
|
||||
readtext, print_generic
|
||||
from entropy.client.interfaces import Client
|
||||
from entropy.client.interfaces.package import Package as ClientPkg
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.services.client import WebService
|
||||
from entropy.cli import countdown, enlightenatom, get_entropy_webservice
|
||||
|
||||
@@ -315,11 +315,9 @@ def show_config_files_to_update(entropy_client):
|
||||
|
||||
if len(scandata) > 0: # strict check
|
||||
if not etpUi['quiet']:
|
||||
mytxt = "%s %s %s." % (
|
||||
_("There are"),
|
||||
len(scandata),
|
||||
_("configuration file(s) needing update"),
|
||||
)
|
||||
mytxt = P_("There is %s configuration file needing update",
|
||||
"There are %s configuration files needing update",
|
||||
len(scandata)) % len(scandata)
|
||||
print_warning(darkgreen(mytxt))
|
||||
mytxt = "%s: %s" % (red(_("Please run")), bold("equo conf update"))
|
||||
print_warning(mytxt)
|
||||
@@ -1136,7 +1134,8 @@ def _fetch_packages(entropy_client, run_queue, downdata, multifetch = 1,
|
||||
|
||||
xterm_header = "equo ("+_("fetch")+") :: "+str(fetchqueue)+" of "+mytotalqueue+" ::"
|
||||
print_info(red(" :: ")+bold("(")+blue(str(fetchqueue))+"/"+ \
|
||||
red(mytotalqueue)+bold(") ")+">>> "+darkgreen(str(len(matches)))+" "+_("packages"))
|
||||
red(mytotalqueue)+bold(") ")+">>> "+darkgreen(str(len(matches)))+" "+ \
|
||||
P_("package", "packages", len(matches)))
|
||||
|
||||
rc = Package.run(xterm_header = xterm_header)
|
||||
if rc != 0:
|
||||
|
||||
@@ -22,7 +22,7 @@ from entropy.const import etpConst, etpUi, const_setup_perms, \
|
||||
const_isunicode, const_convert_to_unicode, const_debug_write, \
|
||||
const_convert_to_rawstring
|
||||
from entropy.exceptions import PermissionDenied, SPMError
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.output import brown, blue, bold, darkgreen, \
|
||||
darkblue, red, purple, darkred, teal
|
||||
from entropy.client.interfaces.client import Client
|
||||
@@ -2981,7 +2981,7 @@ class Package:
|
||||
mytxt = "%s: %s %s" % (
|
||||
blue(_("Downloading")),
|
||||
darkred(str(m_fetch_len)),
|
||||
_("archives"),
|
||||
P_("archive", "archives", m_fetch_len),
|
||||
)
|
||||
|
||||
self._entropy.output(
|
||||
@@ -3494,8 +3494,9 @@ class Package:
|
||||
return self._fetch_step()
|
||||
|
||||
def do_multi_fetch():
|
||||
m_fetch_len = len(self.pkgmeta['multi_fetch_list']) / 2
|
||||
self._xterm_title += ' %s: %s %s' % (_("Multi Fetching"),
|
||||
len(self.pkgmeta['multi_fetch_list']) / 2, _("packages"),)
|
||||
m_fetch_len, P_("package", "packages", m_fetch_len),)
|
||||
self._entropy.set_title(self._xterm_title)
|
||||
return self._multi_fetch_step()
|
||||
|
||||
@@ -3513,8 +3514,9 @@ class Package:
|
||||
return self._checksum_step()
|
||||
|
||||
def do_multi_checksum():
|
||||
m_checksum_len = len(self.pkgmeta['multi_checksum_list'])
|
||||
self._xterm_title += ' %s: %s %s' % (_("Multi Verification"),
|
||||
len(self.pkgmeta['multi_checksum_list']), _("packages"),)
|
||||
m_checksum_len, P_("package", "packages", m_checksum_len),)
|
||||
self._entropy.set_title(self._xterm_title)
|
||||
return self._multi_checksum_step()
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import sys
|
||||
import subprocess
|
||||
|
||||
from entropy.const import const_debug_write, etpConst
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.exceptions import RepositoryError, PermissionDenied
|
||||
from entropy.output import blue, darkred, red, darkgreen, bold, purple, teal, \
|
||||
brown
|
||||
@@ -189,9 +189,11 @@ class Repository:
|
||||
human_size = entropy.tools.bytes_into_human(pkgs_size)
|
||||
mytxt = "%s: %s %s %s." % (
|
||||
teal("Packages"),
|
||||
purple(_("there are")),
|
||||
purple(P_("there is", "there are", number_of_pkgs)),
|
||||
brown(str(number_of_pkgs)),
|
||||
purple(_("package files that could be removed")),
|
||||
purple(P_("package file that could be removed",
|
||||
"package files that could be removed",
|
||||
number_of_pkgs)),
|
||||
)
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
|
||||
@@ -38,7 +38,7 @@ from entropy.const import etpConst, const_isfileobj, const_debug_write
|
||||
from entropy.output import TextInterface, darkblue, darkred, purple, blue, \
|
||||
brown, darkgreen, red
|
||||
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.misc import ParallelTask
|
||||
from entropy.core.settings.base import SystemSettings
|
||||
|
||||
@@ -1067,7 +1067,7 @@ class MultipleUrlFetcher(TextInterface):
|
||||
"%s: %s %s" % (
|
||||
darkblue(_("Aggregated download")),
|
||||
darkred(str(len(pl))),
|
||||
darkblue(_("items")),
|
||||
darkblue(P_("item", "items", len(pl))),
|
||||
),
|
||||
importance = 0,
|
||||
level = "info",
|
||||
|
||||
@@ -23,7 +23,7 @@ from entropy.output import nocolor
|
||||
from entropy.client.interfaces import Client
|
||||
from entropy.const import etpConst
|
||||
import entropy.tools
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
|
||||
# Magneto imports
|
||||
from magneto.core import config
|
||||
@@ -221,19 +221,16 @@ class MagnetoCore(MagnetoCoreUI):
|
||||
upd_len = len(updates)
|
||||
|
||||
if upd_len:
|
||||
self.update_tooltip("%s %s %s" % (
|
||||
_("There are"),
|
||||
upd_len,
|
||||
_("updates available"),)
|
||||
self.update_tooltip(P_("There is %s update available",
|
||||
"There are %s updates available",
|
||||
upd_len) % (upd_len,)
|
||||
)
|
||||
self.set_state("CRITICAL")
|
||||
self.show_alert(
|
||||
_("Sabayon updates available"),
|
||||
"%s %s %s" % (
|
||||
_("There are"),
|
||||
"<b>%s</b>" % (upd_len,),
|
||||
_("updates available"),
|
||||
),
|
||||
P_("There is <b>%s</b> update available",
|
||||
"There are <b>%s</b> updates available",
|
||||
upd_len) % (upd_len,),
|
||||
urgency = "critical",
|
||||
force = self.manual_check_triggered
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.output import bold, purple, darkgreen, blue, teal
|
||||
|
||||
import entropy.tools
|
||||
@@ -144,7 +144,7 @@ over just use the *--no-copy* switch.
|
||||
entropy_server.output(
|
||||
"%s %s %s: %s" % (
|
||||
len(pkglist),
|
||||
darkgreen(_("packages")),
|
||||
darkgreen(P_("package", "packages", len(pkglist))),
|
||||
blue(_("would be copied to branch")),
|
||||
bold(self._to_branch),
|
||||
),
|
||||
|
||||
@@ -44,7 +44,7 @@ import entropy.tools
|
||||
from entropy.const import etpConst, const_get_stringtype, \
|
||||
initconfig_entropy_constants, const_convert_to_unicode, \
|
||||
const_debug_write
|
||||
from entropy.i18n import _
|
||||
from entropy.i18n import _, P_
|
||||
from entropy.misc import ParallelTask
|
||||
from entropy.cache import EntropyCacher, MtimePingus
|
||||
from entropy.output import print_generic
|
||||
@@ -1931,7 +1931,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
empty = True
|
||||
|
||||
self.set_status_ticker("%s: %s %s" % (
|
||||
_("Showing"), len(allpkgs), _("items"),))
|
||||
_("Showing"), len(allpkgs), P_("item", "items", len(allpkgs)),))
|
||||
|
||||
show_pkgsets = False
|
||||
if action == "pkgsets":
|
||||
|
||||
Reference in New Issue
Block a user