From 0682613f940055917e3ddaa1cb6687758843ce9e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 22 Dec 2025 19:05:05 +0100 Subject: [PATCH] fix: better error message --- locale/fr/LC_MESSAGES/rougail.po | 94 +++++++++++-------- locale/rougail.pot | 28 +++--- src/rougail/locale/fr/LC_MESSAGES/rougail.mo | Bin 26987 -> 26792 bytes src/rougail/user_data.py | 61 +++++------- 4 files changed, 94 insertions(+), 89 deletions(-) diff --git a/locale/fr/LC_MESSAGES/rougail.po b/locale/fr/LC_MESSAGES/rougail.po index 45efcf3be..22f8bec36 100644 --- a/locale/fr/LC_MESSAGES/rougail.po +++ b/locale/fr/LC_MESSAGES/rougail.po @@ -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" diff --git a/locale/rougail.pot b/locale/rougail.pot index 48cbdf2f9..c2d7f4532 100644 --- a/locale/rougail.pot +++ b/locale/rougail.pot @@ -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 \n" "Language-Team: LANGUAGE \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 diff --git a/src/rougail/locale/fr/LC_MESSAGES/rougail.mo b/src/rougail/locale/fr/LC_MESSAGES/rougail.mo index 8189a618818358a273527ae19b8ce00d4266798b..002ca30479b66ed2dc556652d826330a167c2995 100644 GIT binary patch delta 4520 zcmZwK4Nz3q8OHG!QA9C-C`uG`0l!5=ToiQ`L@bD=v8aIf1rjMB8Uz)^kF6SGlQwEy zqoy{|q$b6Z#w1%!8nyV5HtjfOCU&N+=~PW@+E`;VnT$HIwdw!ad!5v@ck=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)Jz}7mDrK#UWS2nRCL2nP+u&AIU|E` z8xF>k7=t%ZBl{BbF`D70;dl(g7NQX+k`aV{xj)zAQ1_=l_B>Ii%E&sx%mmyWdV*U_X8$s<0Zcn{6WTA}27R!-oC;NP zupb#k-X?F5_Og?T&TxCt8a@?jJd4`24-&2ML{dO5kWBJZa)794Nwv=cTh*d;BhL}G zfxE+X{;4CcvtVzLR|sECc8Dw|KO!nWAP&*KRf!_U$xld6vVy4SfZXTS z+?Rkg<9zZoi6lQHDld>?x5l@0NKr_BMuw5sh)Sx5`+A<&^<+31L}rmD(q6i^S1?|i zC6-E85>DPEr%8M1Po;wB_|}jvIxAsxwNQcL{giQtTGH^YP55|&1XFK*nEQtG~@ zIur8z&d8Kl=VnSjXMJi?@Xsl;J9qFsx?;7{mXa8;VfaSpa(r@Fu9J}E|L$`5hT%?8 zUZ#6B!+k%8_cNTac^OViR&sDg))_s-nU^~#VsWF-8Iw2IsmP5AZqIEAcb4VlbjZ!m z$qgRLyB86>Q_vO@(a^ZYsVN`e^eN9)Jy=s-72DCba>d%!PFzKj+lhk(J|4HDI_-bg z)r$-DL%qvU?#F!_hHZ5Cs1vg=(s8O&BHOR(gU*w){K0G0*E+k;i)+YneY?ImSke#~ F@n6SJFW>+G diff --git a/src/rougail/user_data.py b/src/rougail/user_data.py index fad17c0e3..bd1e27b1c 100644 --- a/src/rougail/user_data.py +++ b/src/rougail/user_data.py @@ -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}' + type_ = option.type(translation=True) + msg = _('the value "{0}" is an invalid {1}, {2}').format( + self._display_value(option, value), + type_, + err, ) - 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} - ) + if self.invalid_user_data_error: + msg += _(', it has been loading from {0}').format(options["source"]) 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( - self._display_value(option, value), - type_, - err, - options["source"], - ): option._subconfig} - ) + 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)