commit:     12f9d2104964aed1d3f1adf223199fa1552898cb
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jan  5 02:07:32 2026 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Jan  5 02:07:32 2026 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=12f9d210

Soften the tone of diagnostics for the lax validation mode

Presently, there are three potential diagnostics that are a consequence
of failing to validate the locale.gen(5) file against the contents of
the SUPPORTED file.

- Invalid locale
- Invalid charmap
- Unsupported locale/charmap

However, to employ "invalid" as an adjective is jarring in situations
where the lax validation mode has been enabled (by way of the
LOCALEGEN_ALLOW_UNSUPPORTED variable).

Address this minor issue by consistently employing an adjective of
"unsupported" for the lax validation mode.

See-also: 8065bb9fedfe32df1762fe9ba190cf58cf6285d1
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/locale-gen b/locale-gen
index be77855..0a61ee8 100644
--- a/locale-gen
+++ b/locale-gen
@@ -355,6 +355,9 @@ sub parse_config ($fh, $path, $supported_by, $be_strict) {
                }
        };
 
+       # Select an appropriate adjective for errors of validation.
+       my $adjective = $be_strict ? 'Invalid' : 'Unsupported';
+
        my @locales;
        while (my $line = readline $fh) {
                # Skip comments and blank lines. Note that \h will match only
@@ -396,9 +399,9 @@ sub parse_config ($fh, $path, $supported_by, $be_strict) {
                # Validate both locale and character map before accepting.
                my $is_aliasable;
                if (! $supported_by->{$locale}) {
-                       $thrower->('Invalid locale', $line);
+                       $thrower->("$adjective locale", $line);
                } elsif (! $supported_by->{''}{$charmap}) {
-                       $thrower->('Invalid charmap', $line);
+                       $thrower->("$adjective charmap", $line);
                } elsif (! defined($is_aliasable = 
$supported_by->{$locale}{$charmap})) {
                        $thrower->('Unsupported locale/charmap combination', 
$line);
                }

Reply via email to