fix: user_data plugins could have annotator function

This commit is contained in:
egarette@silique.fr 2024-11-25 09:12:52 +01:00
parent 56659f7ea4
commit fbb1446fa3
4 changed files with 47 additions and 39 deletions

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2024-10-30 13:21+0100\n"
"PO-Revision-Date: 2024-10-30 13:39+0100\n"
"POT-Creation-Date: 2024-11-25 09:10+0100\n"
"PO-Revision-Date: 2024-11-25 09:11+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -16,31 +16,31 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.5\n"
#: src/rougail/annotator/family.py:142
#: src/rougail/annotator/family.py:141
msgid "default variable mode \"{0}\" is not a valid mode, valid modes are {1}"
msgstr ""
"le mode d'une variable par défaut \"{0}\" n'est pas un mode valide, les "
"modes valides sont {1}"
#: src/rougail/annotator/family.py:148
#: src/rougail/annotator/family.py:147
msgid "default family mode \"{0}\" is not a valid mode, valid modes are {1}"
msgstr ""
"le mode d'une famille par défaut \"{0}\" n'est pas un mode valide, les modes "
"valides sont {1}"
#: src/rougail/annotator/family.py:180
#: src/rougail/annotator/family.py:179
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, valid modes are {2}"
msgstr ""
"le mode \"{0}\" pour \"{1}\" n'est pas un mode valide, les modes valides "
"sont {2}"
#: src/rougail/annotator/family.py:184
#: src/rougail/annotator/family.py:183
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, no modes are available"
msgstr ""
"le mode \"{0}\" pour \"{1}\" n'est pas un mode valide, aucun mode ne sont "
"définis"
#: src/rougail/annotator/family.py:248
#: src/rougail/annotator/family.py:247
msgid ""
"the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the "
"higher family mode \"{2}\""
@ -48,7 +48,7 @@ msgstr ""
"la variable \"{0}\" est obligatoire donc dans le mode \"{1}\" mais la "
"famille a un mode supérieur \"{2}\""
#: src/rougail/annotator/family.py:286
#: src/rougail/annotator/family.py:285
msgid ""
"the follower \"{0}\" is in \"{1}\" mode but leader have the higher mode "
"\"{2}\""
@ -56,7 +56,7 @@ msgstr ""
"la variable suiveuse \"{0}\" a le mode \"{1}\" mais la variable leader a un "
"mode supérieur \"{2}\""
#: src/rougail/annotator/family.py:319
#: src/rougail/annotator/family.py:318
msgid ""
"the family \"{0}\" is in \"{1}\" mode but variables and families inside have "
"the higher modes \"{2}\""
@ -64,7 +64,7 @@ msgstr ""
"la famille \"{0}\" a le mode \"{1}\" mais les variables et les familles à "
"l'intérieur ont des modes supérieurs \"{2}\""
#: src/rougail/annotator/family.py:337
#: src/rougail/annotator/family.py:336
msgid ""
"the variable \"{0}\" is in \"{1}\" mode but family has the higher family "
"mode \"{2}\""
@ -72,37 +72,37 @@ msgstr ""
"la variable \"{0}\" est dans le mode \"{1}\" mais la famille a le mode "
"supérieur \"{2}\""
#: src/rougail/annotator/value.py:80
#: src/rougail/annotator/value.py:77
msgid "the follower \"{0}\" without multi attribute can only have one value"
msgstr ""
"la variable suiveuse \"{0}\" sans l'attribut multi peut avoir seulement une "
"valeur"
#: src/rougail/annotator/value.py:96
#: src/rougail/annotator/value.py:93
msgid "the variable \"{0}\" is multi but has a non list default value"
msgstr ""
"la variable \"{0}\" est multiple mais a une valeur par défaut sans être une "
"liste"
#: src/rougail/annotator/variable.py:192
#: src/rougail/annotator/variable.py:189
msgid ""
"the variable \"{0}\" has regexp attribut but has not the \"regexp\" type"
msgstr ""
"la variable \"{0}\" a un attribut regexp mais n'a pas le type \"regexp\""
#: src/rougail/annotator/variable.py:235
#: src/rougail/annotator/variable.py:232
msgid ""
"the variable \"{0}\" has choices attribut but has not the \"choice\" type"
msgstr ""
"la variable \"{0}\" a un attribut choices mais n'a pas le type \"choice\""
#: src/rougail/annotator/variable.py:263
#: src/rougail/annotator/variable.py:260
msgid ""
"the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}"
msgstr ""
"la variable \"{0}\" a la valeur par défaut invalide \"{1}\" devrait être {2}"
#: src/rougail/convert.py:268
#: src/rougail/convert.py:281
msgid ""
"A variable or a family located in the \"{0}\" namespace shall not be used in "
"the \"{1}\" namespace"
@ -110,38 +110,38 @@ msgstr ""
"Une variable ou une famille localisé dans l'espace de nom \"{0}\" ne devrait "
"pas être utilisé dans l'espace de nom \"{1}\""
#: src/rougail/convert.py:462
#: src/rougail/convert.py:477
msgid "unknown type {0} for {1}"
msgstr "type {0} inconnu pour {1}"
#: src/rougail/convert.py:1323
#: src/rougail/convert.py:1347
msgid "duplicate dictionary file name {0}"
msgstr "nom de fichier {0} de dictionnaire dupliqué"
#: src/rougail/convert.py:1370
#: src/rougail/convert.py:1394
msgid "Cannot execute annotate multiple time"
msgstr "Ne peut exécuter l'annotation plusieurs fois"
#: src/rougail/error.py:70
#: src/rougail/error.py:67
msgid "{0} in {1}"
msgstr "{0} dans {1}"
#: src/rougail/structural_commandline/annotator.py:70
#: src/rougail/structural_commandline/annotator.py:67
msgid "alternative_name \"{0}\" conflict with \"--help\""
msgstr "alternative_name \"{0}\" est en conflit avec \"--help\""
#: src/rougail/structural_commandline/annotator.py:73
#: src/rougail/structural_commandline/annotator.py:72
msgid "conflict alternative_name \"{0}\": \"{1}\" and \"{2}\""
msgstr "conflit dans les \"alternative_name\" \"{0}\": \"{1}\" et \"{2}\""
#: src/rougail/structural_commandline/annotator.py:96
#: src/rougail/structural_commandline/annotator.py:95
msgid ""
"negative_description is mandatory for boolean variable, but \"{0}\" hasn't"
msgstr ""
"l'attribut negative_description est obligatoire pour des variables "
"\"boolean\", mais \"{0}\" n'en a pas"
#: src/rougail/structural_commandline/annotator.py:105
#: src/rougail/structural_commandline/annotator.py:104
msgid ""
"negative_description is only available for boolean variable, but \"{0}\" is "
"\"{1}\""
@ -149,11 +149,11 @@ msgstr ""
"l'attribut negative_description est seulement valide pour des variables "
"\"boolean\", mais \"{0}\" est \"{1}\""
#: src/rougail/update/update.py:741
#: src/rougail/update/update.py:738
msgid "not a XML file: {0}"
msgstr "fichier XML invalid : {0}"
#: src/rougail/utils.py:58
#: src/rougail/utils.py:55
msgid ""
"invalid variable or family name \"{0}\" must only contains lowercase ascii "
"character, number or _"
@ -161,6 +161,6 @@ msgstr ""
"nom invalide pour la variable ou famille \"{0}\" doit seulement contenir des "
"caractères ascii minuscule, nombre or _"
#: src/rougail/utils.py:120
#: src/rougail/utils.py:117
msgid "error in jinja \"{0}\" for the variable \"{1}\": {2}"
msgstr "erreur dans Jinja \"{0}\" pour la variable \"{1}\": {2}"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-11-04 12:04+0100\n"
"POT-Creation-Date: 2024-11-25 09:10+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"
@ -15,35 +15,35 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
#: src/rougail/annotator/family.py:139
#: src/rougail/annotator/family.py:141
msgid "default variable mode \"{0}\" is not a valid mode, valid modes are {1}"
msgstr ""
#: src/rougail/annotator/family.py:145
#: src/rougail/annotator/family.py:147
msgid "default family mode \"{0}\" is not a valid mode, valid modes are {1}"
msgstr ""
#: src/rougail/annotator/family.py:177
#: src/rougail/annotator/family.py:179
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, valid modes are {2}"
msgstr ""
#: src/rougail/annotator/family.py:181
#: src/rougail/annotator/family.py:183
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, no modes are available"
msgstr ""
#: src/rougail/annotator/family.py:245
#: src/rougail/annotator/family.py:247
msgid "the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the higher family mode \"{2}\""
msgstr ""
#: src/rougail/annotator/family.py:283
#: src/rougail/annotator/family.py:285
msgid "the follower \"{0}\" is in \"{1}\" mode but leader have the higher mode \"{2}\""
msgstr ""
#: src/rougail/annotator/family.py:316
#: src/rougail/annotator/family.py:318
msgid "the family \"{0}\" is in \"{1}\" mode but variables and families inside have the higher modes \"{2}\""
msgstr ""
#: src/rougail/annotator/family.py:334
#: src/rougail/annotator/family.py:336
msgid "the variable \"{0}\" is in \"{1}\" mode but family has the higher family mode \"{2}\""
msgstr ""
@ -71,15 +71,15 @@ msgstr ""
msgid "A variable or a family located in the \"{0}\" namespace shall not be used in the \"{1}\" namespace"
msgstr ""
#: src/rougail/convert.py:475
#: src/rougail/convert.py:477
msgid "unknown type {0} for {1}"
msgstr ""
#: src/rougail/convert.py:1345
#: src/rougail/convert.py:1347
msgid "duplicate dictionary file name {0}"
msgstr ""
#: src/rougail/convert.py:1392
#: src/rougail/convert.py:1394
msgid "Cannot execute annotate multiple time"
msgstr ""

View file

@ -71,6 +71,11 @@ class SpaceAnnotator: # pylint: disable=R0903
if extra_annotator in ANNOTATORS:
continue
get_annotators(ANNOTATORS, extra_annotator)
for user_data in objectspace.user_datas:
try:
get_annotators(ANNOTATORS, f"rougail.user_data_{user_data}", "annotator")
except ModuleNotFoundError:
pass
for plugin in objectspace.plugins:
try:
get_annotators(ANNOTATORS, f"rougail.{plugin}", "annotator")
@ -81,6 +86,8 @@ class SpaceAnnotator: # pylint: disable=R0903
annotators.extend(ANNOTATORS[extra_annotator])
for plugin in objectspace.plugins:
annotators.extend(ANNOTATORS[f"rougail.{plugin}.annotator"])
for user_data in objectspace.user_datas:
annotators.extend(ANNOTATORS[f"rougail.user_data_{user_data}.annotator"])
annotators = sorted(annotators, key=get_level)
functions = {}
functions_files = objectspace.functions_files

View file

@ -394,6 +394,7 @@ class ParserVariable:
self.add_extra_options = rougailconfig[
"structural_commandline.add_extra_options"
]
self.user_datas = rougailconfig["step.user_data"]
self.plugins = rougailconfig["plugins"]
def _init(self):