chiark / gitweb /
Correct plurals
authorJan Berkel <jan@berkel.fr>
Wed, 13 Sep 2017 15:33:57 +0000 (17:33 +0200)
committerJan Berkel <jan@berkel.fr>
Fri, 15 Sep 2017 12:16:30 +0000 (14:16 +0200)
fdroidserver/build.py
fdroidserver/publish.py

index 5dfe63ba747085f2bba260e4b3daa732ed528920..d5092a6d8ae0917e4aedea778b68fefe5fe2d7ff 100644 (file)
@@ -31,6 +31,7 @@ import tempfile
 from configparser import ConfigParser
 from argparse import ArgumentParser
 import logging
+from gettext import ngettext
 
 from . import common
 from . import net
@@ -522,9 +523,12 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext
         count = scanner.scan_source(build_dir, build)
         if count > 0:
             if force:
-                logging.warn('Scanner found %d problems' % count)
+                logging.warning(ngettext('Scanner found {} problem',
+                                         'Scanner found {} problems', count).format(count))
             else:
-                raise BuildException("Can't build due to %d errors while scanning" % count)
+                raise BuildException(ngettext(
+                    "Can't build due to {} error while scanning",
+                    "Can't build due to {} errors while scanning", count).format(count))
 
     if not options.notarball:
         # Build the source tarball right before we build the release...
@@ -1318,9 +1322,11 @@ def main():
 
     logging.info("Finished.")
     if len(build_succeeded) > 0:
-        logging.info(str(len(build_succeeded)) + ' builds succeeded')
+        logging.info(ngettext("{} build succeeded",
+                              "{} builds succeeded", len(build_succeeded)).format(len(build_succeeded)))
     if len(failed_apps) > 0:
-        logging.info(str(len(failed_apps)) + ' builds failed')
+        logging.info(ngettext("{} build failed",
+                              "{} builds failed", len(failed_apps)).format(len(failed_apps)))
 
     sys.exit(0)
 
index ad2009067041a1616aaadf3d12143af2bfff38aa..4ef20591a91f42481ce61d2db2a41750dcd08027 100644 (file)
@@ -25,6 +25,7 @@ import glob
 import hashlib
 from argparse import ArgumentParser
 import logging
+from gettext import ngettext
 
 from . import common
 from . import metadata
@@ -98,8 +99,8 @@ def main():
             logging.error("There is a keyalias collision - publishing halted")
             sys.exit(1)
         allaliases.append(keyalias)
-    logging.info("{0} apps, {0} key aliases".format(len(allapps),
-                                                    len(allaliases)))
+    logging.info(ngettext('{0} app, {1} key aliases',
+                          '{0} apps, {1} key aliases', len(allapps)).format(len(allapps), len(allaliases)))
 
     # Process any APKs or ZIPs that are waiting to be signed...
     for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))