Marco Ricci commited on 2025-01-07 19:46:51
Zeige 4 geänderte Dateien mit 48 Einfügungen und 8 Löschungen.
The "Cannot update the global/service settings without actual settings" messages contained "global" and "service" as (English) format string parameters, and the actual translatable string contained no indication what this placeholder actually meant. This is of course a horrible way to request a translation for those two messages. We now include translatable strings for each of the two possible values of the metavar ("global settings" and "service-specific settings"), and proper translation advice for the metavar value and the original translatable strings. The manpages have been updated as well, to reflect the slight change in phrasing of the message.
... | ... |
@@ -340,7 +340,7 @@ The <b>derivepassphrase vault</b> utility exits 0 on success, and >0 if an error |
340 | 340 |
|
341 | 341 |
(Exactly what it says.) |
342 | 342 |
|
343 |
-??? failure "`Cannot update %s settings without actual settings.`" |
|
343 |
+??? failure "`Cannot update the %s settings without actual settings.`" |
|
344 | 344 |
|
345 | 345 |
Using `--config` requires at least one of the `--phrase`, `--key`, `--length`, etc. options. |
346 | 346 |
|
... | ... |
@@ -730,7 +730,7 @@ There was a system error communicating with the SSH agent. |
730 | 730 |
.It Not saving any new notes: the user aborted the request. |
731 | 731 |
(Exactly what it says.) |
732 | 732 |
. |
733 |
-.It Cannot update %s settings without actual settings. |
|
733 |
+.It Cannot update the %s settings without actual settings. |
|
734 | 734 |
Using |
735 | 735 |
.Fl \-config |
736 | 736 |
requires at least one of the |
... | ... |
@@ -227,6 +227,32 @@ class Label(enum.Enum): |
227 | 227 |
WARNING_LABEL = _prepare_translatable( |
228 | 228 |
'Warning', comments='', context='diagnostic label' |
229 | 229 |
) |
230 |
+ CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_GLOBAL = ( |
|
231 |
+ _prepare_translatable( |
|
232 |
+ comments=r""" |
|
233 |
+ TRANSLATORS: This is one of two values of the settings_type |
|
234 |
+ metavar used in the CANNOT_UPDATE_SETTINGS_NO_SETTINGS |
|
235 |
+ entry. It is only used there. The full sentence then |
|
236 |
+ reads: "Cannot update the global settings without any given |
|
237 |
+ settings." |
|
238 |
+ """, |
|
239 |
+ msg='global settings', |
|
240 |
+ context='diagnostic label (metavar value)', |
|
241 |
+ ) |
|
242 |
+ ) |
|
243 |
+ CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_SERVICE = ( |
|
244 |
+ _prepare_translatable( |
|
245 |
+ comments=r""" |
|
246 |
+ TRANSLATORS: This is one of two values of the settings_type |
|
247 |
+ metavar used in the CANNOT_UPDATE_SETTINGS_NO_SETTINGS |
|
248 |
+ entry. It is only used there. The full sentence then |
|
249 |
+ reads: "Cannot update the service-specific settings without |
|
250 |
+ any given settings." |
|
251 |
+ """, |
|
252 |
+ msg='service-specific settings', |
|
253 |
+ context='diagnostic label (metavar value)', |
|
254 |
+ ) |
|
255 |
+ ) |
|
230 | 256 |
DERIVEPASSPHRASE_01 = _prepare_translatable( |
231 | 257 |
msg=""" |
232 | 258 |
Derive a strong passphrase, deterministically, from a master secret. |
... | ... |
@@ -1007,12 +1033,23 @@ class ErrMsgTemplate(enum.Enum): |
1007 | 1033 |
""", |
1008 | 1034 |
) |
1009 | 1035 |
CANNOT_UPDATE_SETTINGS_NO_SETTINGS = _prepare_translatable( |
1036 |
+ comments=r""" |
|
1037 |
+ TRANSLATORS: The settings_type metavar contains translations for |
|
1038 |
+ either "global settings" or "service-specific settings"; see the |
|
1039 |
+ CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_GLOBAL and |
|
1040 |
+ CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_SERVICE entries. |
|
1041 |
+ The first sentence will thus read either "Cannot update the |
|
1042 |
+ global settings without any given settings." or "Cannot update |
|
1043 |
+ the service-specific settings without any given settings.". You |
|
1044 |
+ may update this entry, and the two metavar entries, in any way |
|
1045 |
+ you see fit that achieves the desired translations of the first |
|
1046 |
+ sentence. |
|
1047 |
+ """, |
|
1010 | 1048 |
msg=r""" |
1011 |
- Cannot update {settings_type!s} settings without any given |
|
1012 |
- settings. You must specify at least one of --lower, ..., |
|
1013 |
- --symbol, or --phrase or --key. |
|
1049 |
+ Cannot update the {settings_type!s} without any given settings. |
|
1050 |
+ You must specify at least one of --lower, ..., --symbol, or |
|
1051 |
+ --phrase or --key. |
|
1014 | 1052 |
""", |
1015 |
- comments='', |
|
1016 | 1053 |
context='error message', |
1017 | 1054 |
flags='python-brace-format', |
1018 | 1055 |
) |
... | ... |
@@ -3416,10 +3416,13 @@ def derivepassphrase_vault( # noqa: C901,PLR0912,PLR0913,PLR0914,PLR0915 |
3416 | 3416 |
) |
3417 | 3417 |
logger.warning(w_msg, extra={'color': ctx.color}) |
3418 | 3418 |
if not view.maps[0] and not unset_settings: |
3419 |
- settings_type = 'service' if service else 'global' |
|
3420 | 3419 |
err_msg = _msg.TranslatedString( |
3421 | 3420 |
_msg.ErrMsgTemplate.CANNOT_UPDATE_SETTINGS_NO_SETTINGS, |
3422 |
- settings_type=settings_type, |
|
3421 |
+ settings_type=_msg.TranslatedString( |
|
3422 |
+ _msg.Label.CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_SERVICE |
|
3423 |
+ if service |
|
3424 |
+ else _msg.Label.CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_GLOBAL # noqa: E501 |
|
3425 |
+ ), |
|
3423 | 3426 |
) |
3424 | 3427 |
raise click.UsageError(str(err_msg)) |
3425 | 3428 |
for setting in unset_settings: |
3426 | 3429 |