fix: better error message

This commit is contained in:
egarette@silique.fr 2025-12-22 19:05:05 +01:00
parent 27350dcab4
commit 0682613f94
4 changed files with 94 additions and 89 deletions

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-12-22 15:32+0100\n"
"PO-Revision-Date: 2025-12-22 15:35+0100\n"
"POT-Creation-Date: 2025-12-22 19:02+0100\n"
"PO-Revision-Date: 2025-12-22 19:04+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -980,56 +980,50 @@ msgstr ""
"la famille {0} est {1}, {2} à l'index \"{3}\", elle a été chargée depuis {4}"
#: src/rougail/user_data.py:421
msgid "variable is {0}, it has been loading from {1}"
msgstr "la variable est {0}, elle a été chargée depuis {1}"
msgid "variable has propery {0}, it has been loading from {1}"
msgstr "la variable a la propriété {0}, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:425
msgid "variable is {0}, it will be ignored when loading from {1}"
msgstr "la variable est {0}, elle sera ignorée lors du chargement depuis {1}"
msgid "variable has property {0}, it will be ignored when loading from {1}"
msgstr ""
"la variable a la propriété {0}, elle sera ignorée lors du chargement depuis "
"{1}"
#: src/rougail/user_data.py:435
msgid ""
"family {0} is {1}, so cannot access to {2}, it has been loading from {3}"
"family {0} has property {1}, so cannot access to {2}, it has been loading "
"from {3}"
msgstr ""
"la famille {0} est {1}, donc ne peut accéder à {2}, elle a été chargée "
"depuis {3}"
"la famille {0} a la propriété {1}, donc ne peut accéder à {2}, elle a été "
"chargée depuis {3}"
#: src/rougail/user_data.py:439
msgid ""
"family {0} is {1}, so cannot access to {2}, it will be ignored when loading "
"from {3}"
"family {0} has property {1}, so cannot access to {2}, it will be ignored "
"when loading from {3}"
msgstr ""
"la famille {0} est {1}, donc ne peut accéder à {2}, sera ignorée lors du "
"chargement depuis {3}"
"la famille {0} a la propriété {1}, donc ne peut accéder à {2}, sera ignorée "
"lors du chargement depuis {3}"
#: src/rougail/user_data.py:459
msgid "{0}, it has been loading from {1}"
msgstr "{0}, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:461
msgid ""
"the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it has "
"been loading from {5}"
msgstr ""
"la valeur \"{0}\" est un {1} invalide pour {2} à l'index \"{3}\", {4}, elle "
"a été chargée depuis {5}"
msgid "{0}, it will be ignored when loading from {1}"
msgstr "{0}, elle sera ignorée lors du chargement depuis {1}"
#: src/rougail/user_data.py:465
msgid ""
"the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it will "
"be ignored when loading from {5}"
msgstr ""
"la valeur \"{0}\" est un {1} invalide pour {2} à l'index \"{3}\", {4}, elle "
"sera ignorée lors du chargement depuis {5}"
#: src/rougail/user_data.py:466
msgid "the value \"{0}\" is an invalid {1}, {2}"
msgstr "la valeur \"{0}\" est un {1} invalide, {2}"
#: src/rougail/user_data.py:481
msgid "the value \"{0}\" is an invalid {1}, {2}, it has been loading from {3}"
msgstr ""
"la valeur \"{0}\" est un {1} invalide pour {2}, elle a été chargée depuis {3}"
#: src/rougail/user_data.py:472
msgid ", it has been loading from {0}"
msgstr ", elle a été chargée depuis {0}"
#: src/rougail/user_data.py:485
msgid ""
"the value \"{0}\" is an invalid {1}, {2}, it will be ignored when loading "
"from {3}"
msgstr ""
"la valeur \"{0}\" est un {1} invalide pour {2}, elle sera ignorée lors du "
"chargement depuis {3}"
#: src/rougail/user_data.py:474
msgid ", it will be ignored when loading from {0}"
msgstr ", elle sera ignorée lors du chargement depuis {0}"
#: src/rougail/utils.py:56
msgid ""
@ -1063,6 +1057,32 @@ msgstr "unique"
msgid "auto modified"
msgstr "auto modifiée"
#~ msgid ""
#~ "the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it has "
#~ "been loading from {5}"
#~ msgstr ""
#~ "la valeur \"{0}\" est un {1} invalide pour {2} à l'index \"{3}\", {4}, "
#~ "elle a été chargée depuis {5}"
#~ msgid ""
#~ "the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it "
#~ "will be ignored when loading from {5}"
#~ msgstr ""
#~ "la valeur \"{0}\" est un {1} invalide pour {2} à l'index \"{3}\", {4}, "
#~ "elle sera ignorée lors du chargement depuis {5}"
#~ msgid ""
#~ "the value \"{0}\" is an invalid {1}, {2}, it has been loading from {3}"
#~ msgstr ""
#~ "la valeur \"{0}\" est un {1} invalide, {2}, elle a été chargée depuis {3}"
#~ msgid ""
#~ "the value \"{0}\" is an invalid {1}, {2}, it will be ignored when loading "
#~ "from {3}"
#~ msgstr ""
#~ "la valeur \"{0}\" est un {1} invalide, {2}, elle sera ignorée lors du "
#~ "chargement depuis {3}"
#~ msgid "The secret pattern to build item name in Bitwarden"
#~ msgstr ""
#~ "Le patron de secret pour construire le nom de l'élément dans Bitwarden"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-12-22 15:35+0100\n"
"POT-Creation-Date: 2025-12-22 19:04+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -732,35 +732,39 @@ msgid "family {0} is {1}, {2} at index \"{3}\", it will be ignored when loading
msgstr ""
#: src/rougail/user_data.py:421
msgid "variable is {0}, it has been loading from {1}"
msgid "variable has propery {0}, it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:425
msgid "variable is {0}, it will be ignored when loading from {1}"
msgid "variable has property {0}, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:435
msgid "family {0} is {1}, so cannot access to {2}, it has been loading from {3}"
msgid "family {0} has property {1}, so cannot access to {2}, it has been loading from {3}"
msgstr ""
#: src/rougail/user_data.py:439
msgid "family {0} is {1}, so cannot access to {2}, it will be ignored when loading from {3}"
msgid "family {0} has property {1}, so cannot access to {2}, it will be ignored when loading from {3}"
msgstr ""
#: src/rougail/user_data.py:459
msgid "{0}, it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:461
msgid "the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it has been loading from {5}"
msgid "{0}, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:465
msgid "the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it will be ignored when loading from {5}"
#: src/rougail/user_data.py:466
msgid "the value \"{0}\" is an invalid {1}, {2}"
msgstr ""
#: src/rougail/user_data.py:481
msgid "the value \"{0}\" is an invalid {1}, {2}, it has been loading from {3}"
#: src/rougail/user_data.py:472
msgid ", it has been loading from {0}"
msgstr ""
#: src/rougail/user_data.py:485
msgid "the value \"{0}\" is an invalid {1}, {2}, it will be ignored when loading from {3}"
#: src/rougail/user_data.py:474
msgid ", it will be ignored when loading from {0}"
msgstr ""
#: src/rougail/utils.py:56

View file

@ -419,11 +419,11 @@ class UserData:
if path == err_path:
if self.invalid_user_data_error:
msg = _(
"variable is {0}, it has been loading from {1}"
"variable has propery {0}, it has been loading from {1}"
)
else:
msg = _(
"variable is {0}, it will be ignored when loading from {1}"
"variable has property {0}, it will be ignored when loading from {1}"
)
self.unknowns.append({
msg.format(
@ -433,11 +433,11 @@ class UserData:
else:
if self.invalid_user_data_error:
msg = _(
"family {0} is {1}, so cannot access to {2}, it has been loading from {3}"
"family {0} has property {1}, so cannot access to {2}, it has been loading from {3}"
)
else:
msg = _(
"family {0} is {1}, so cannot access to {2}, it will be ignored when loading from {3}"
"family {0} has property {1}, so cannot access to {2}, it will be ignored when loading from {3}"
)
self.unknowns.append({
msg.format(
@ -453,46 +453,26 @@ class UserData:
)
except LeadershipError as err:
self.unknowns.append({_("{0} in {1}").format(err, options["source"]): option._subconfig})
except ConfigError as err:
err.prefix = ""
if self.invalid_user_data_error:
msg = _('{0}, it has been loading from {1}').format(err, options["source"])
else:
msg = _('{0}, it will be ignored when loading from {1}').format(err, options["source"])
self.invalids.append({msg: option._subconfig})
except ValueError as err:
err.prefix = ""
if index is not None:
type_ = option.type(translation=True)
if self.invalid_user_data_error:
msg = _(
'the value "{0}" is an invalid {1} for {2} at index "{3}", {4}, it has been loading from {5}'
)
else:
msg = _(
'the value "{0}" is an invalid {1} for {2} at index "{3}", {4}, it will be ignored when loading from {5}'
)
self.invalids.append({
msg.format(
self._display_value(option, value),
type_,
option.description(with_quote=True),
index,
err,
options["source"],
): option._subconfig}
)
else:
type_ = option.type(translation=True)
if self.invalid_user_data_error:
msg = _(
'the value "{0}" is an invalid {1}, {2}, it has been loading from {3}'
)
else:
msg = _(
'the value "{0}" is an invalid {1}, {2}, it will be ignored when loading from {3}'
)
self.invalids.append({
msg.format(
msg = _('the value "{0}" is an invalid {1}, {2}').format(
self._display_value(option, value),
type_,
err,
options["source"],
): option._subconfig}
)
if self.invalid_user_data_error:
msg += _(', it has been loading from {0}').format(options["source"])
else:
msg += _(', it will be ignored when loading from {0}').format(options["source"])
self.invalids.append({msg: option._subconfig})
except AttributeOptionError as err:
if err.code == "option-dynamic":
continue
@ -504,6 +484,7 @@ class UserData:
# it's a function
params = tuple([ParamValue(val) for val in value[1:]])
value = Calculation(value[0], Params(params, kwargs={"option": ParamValue(option)}))
option = self.config.forcepermissive.option(option.path(), option.index())
option.value.set(value)