From: Michael Tremer Date: Mon, 22 Dec 2025 09:58:37 +0000 (+0000) Subject: dnsbl: Use Babel to format the number of domains properly X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbd194f00a88f096cc566363f7f237c62d1b7a88;p=dbl.git dnsbl: Use Babel to format the number of domains properly Signed-off-by: Michael Tremer --- diff --git a/configure.ac b/configure.ac index f707deb..54ffd16 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,7 @@ AC_PROG_MKDIR_P # Python AM_PATH_PYTHON([3.13]) +AX_PYTHON_MODULE([babel], [fatal]) AX_PYTHON_MODULE([httpx], [fatal]) AX_PYTHON_MODULE([rich], [fatal]) AX_PYTHON_MODULE([sqlmodel], [fatal]) diff --git a/src/scripts/dnsbl.in b/src/scripts/dnsbl.in index 841e63a..e7ca4c6 100644 --- a/src/scripts/dnsbl.in +++ b/src/scripts/dnsbl.in @@ -20,6 +20,7 @@ ############################################################################### import argparse +import babel.numbers import dnsbl import dnsbl.exporters import logging @@ -192,7 +193,7 @@ class CLI(object): table.add_column(_("Slug")) table.add_column(_("License")) table.add_column(_("Last Updated")) - table.add_column(_("Listed Unique Domains")) + table.add_column(_("Listed Unique Domains"), justify="right") # Show all lists for list in backend.lists: @@ -201,7 +202,7 @@ class CLI(object): list.slug, list.license, list.updated_at.isoformat() if list.updated_at else _("N/A"), - "%s" % len(list), + babel.numbers.format_decimal(len(list)), ) # Print the table @@ -243,7 +244,7 @@ class CLI(object): table.add_row(_("License"), list.license) table.add_row(_("Created At"), list.created_at.isoformat()) table.add_row(_("Created By"), list.created_by) - table.add_row(_("Listed Unique Domains"), "%s" % len(list)) + table.add_row(_("Listed Unique Domains"), babel.numbers.format_decimal(len(list))) # Print list properties self.console.print(table) @@ -255,7 +256,7 @@ class CLI(object): table.add_column(_("URL")) table.add_column(_("Created At")) table.add_column(_("Created_By")) - table.add_column(_("Listed Domains")) + table.add_column(_("Listed Domains"), justify="right") for source in list.sources: table.add_row( @@ -264,7 +265,7 @@ class CLI(object): source.url, source.created_at.isoformat(), source.created_by, - "%s" % len(source), + babel.numbers.format_decimal(len(source)), ) # Print the sources