Fix multiple small issues with the CLI messages
Marco Ricci

Marco Ricci commited on 2025-02-11 15:13:16
Zeige 1 geänderte Dateien mit 5 Einfügungen und 4 Löschungen.


  * Otherwise empty translators comments were being prefixed with
    `TRANSLATORS:`, making them non-empty.

  * `Label.DERIVEPASSPHRASE_VAULT_NOTES_INSTRUCTION_TEXT` is actually
    pre-wrapped, but it was missing the "no wrap" marker.

  * In `ErrMsgTemplate.CANNOT_UPDATE_SETTINGS_NO_SETTINGS`, `--notes` is
    also a valid setting to specify.

  * The previous locale code `en_DEBUG` suggests that "DEBUG" is
    [a territory, not a modifier or variant][1].

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
... ...
@@ -359,9 +359,9 @@ class TranslatableString(NamedTuple):
359 359
             A new [`TranslatableString`][] with the specified comments.
360 360
 
361 361
         """
362
-        if not comments.lstrip().startswith(  # pragma: no cover
362
+        if comments.strip() and not comments.lstrip().startswith(
363 363
             'TRANSLATORS:'
364
-        ):
364
+        ):  # pragma: no cover
365 365
             comments = 'TRANSLATORS: ' + comments.lstrip()
366 366
         comments = self._maybe_rewrap(comments, fix_sentence_endings=False)
367 367
         return self._replace(translator_comments=comments)
... ...
@@ -815,6 +815,7 @@ class Label(enum.Enum):
815 815
     )(
816 816
         'Label :: Help text :: Explanation',
817 817
         """\
818
+\b
818 819
 # Enter notes below the line with the cut mark (ASCII scissors and
819 820
 # dashes).  Lines above the cut mark (such as this one) will be ignored.
820 821
 #
... ...
@@ -2050,7 +2051,7 @@ class ErrMsgTemplate(enum.Enum):
2050 2051
     )(
2051 2052
         'Error message',
2052 2053
         'Cannot update the {settings_type!s} without any given settings.  '
2053
-        'You must specify at least one of --lower, ..., --symbol, '
2054
+        'You must specify at least one of --lower, ..., --symbol, --notes, '
2054 2055
         'or --phrase or --key.',
2055 2056
         flags='python-brace-format',
2056 2057
     )
... ...
@@ -2312,7 +2313,7 @@ def _write_po_file(  # noqa: C901,PLR0912
2312 2313
     else:
2313 2314
         po_info.update({
2314 2315
             'Last-Translator': AUTHOR,
2315
-            'Language': 'en_DEBUG',
2316
+            'Language': 'en_US@DEBUG',
2316 2317
             'Language-Team': 'English',
2317 2318
         })
2318 2319
     print(*_format_po_info(po_info), sep='\n', end='\n', file=fileobj)
2319 2320