From 2d9298eb8eed26ef67a617a507e9ffbc113ab57c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 30 Oct 2024 18:45:09 +0100 Subject: [PATCH] feat: translation --- src/rougail/annotator/family.py | 40 ++--- src/rougail/annotator/value.py | 8 +- src/rougail/annotator/variable.py | 12 +- src/rougail/convert.py | 12 +- src/rougail/error.py | 2 +- src/rougail/i18n.py | 32 +--- src/rougail/locale/fr/LC_MESSAGES/rougail.mo | Bin 0 -> 4283 bytes src/rougail/locale/fr/LC_MESSAGES/rougail.po | 166 ++++++++++++++++++ src/rougail/locale/rougail.pot | 117 ++++++++++++ .../structural_commandline/annotator.py | 14 +- src/rougail/update/update.py | 2 +- src/rougail/utils.py | 9 +- .../dictionaries/rougail/00-base.yml | 2 +- .../04_0type_param/makedict/after.json | 2 +- .../04_0type_param/makedict/base.json | 2 +- .../04_0type_param/makedict/before.json | 2 +- .../04_0type_param/makedict/mandatory.json | 2 +- .../04_0type_param/tiramisu/base.py | 4 +- .../04_0type_param/tiramisu/multi.py | 12 +- .../04_0type_param/tiramisu/no_namespace.py | 2 +- 20 files changed, 344 insertions(+), 98 deletions(-) create mode 100644 src/rougail/locale/fr/LC_MESSAGES/rougail.mo create mode 100644 src/rougail/locale/fr/LC_MESSAGES/rougail.po create mode 100644 src/rougail/locale/rougail.pot diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index ece69b703..02d95c767 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -140,16 +140,14 @@ class Annotator(Walk): default_variable_mode = self.default_variable_mode if default_variable_mode not in modes_level: msg = _( - f'default variable mode "{default_variable_mode}" is not a valid mode, ' - f"valid modes are {modes_level}" - ) + 'default variable mode "{0}" is not a valid mode, valid modes are {1}' + ).format(default_variable_mode, modes_level) raise DictConsistencyError(msg, 72, None) default_family_mode = self.default_family_mode if default_family_mode not in modes_level: msg = _( - f'default family mode "{default_family_mode}" is not a valid mode, ' - f"valid modes are {modes_level}" - ) + 'default family mode "{0}" is not a valid mode, valid modes are {1}' + ).format(default_family_mode, modes_level) raise DictConsistencyError(msg, 73, None) families = list(self.get_families()) for family in families: @@ -180,14 +178,12 @@ class Annotator(Walk): if self._has_mode(obj) and obj.mode not in modes_level: if modes_level: msg = _( - f'mode "{obj.mode}" for "{obj.name}" is not a valid mode, ' - f"valid modes are {modes_level}" - ) + 'mode "{0}" for "{1}" is not a valid mode, valid modes are {2}' + ).format(obj.mode, obj.name, modes_level) else: msg = _( - f'mode "{obj.mode}" for "{obj.name}" is not a valid mode, ' - f"no modes are available" - ) + 'mode "{0}" for "{1}" is not a valid mode, no modes are available' + ).format(obj.mode, obj.name) raise DictConsistencyError(msg, 71, obj.xmlfiles) def _set_default_mode( @@ -250,9 +246,8 @@ class Annotator(Walk): and self.modes[variable_mode] < self.modes[family_mode] ): msg = _( - f'the variable "{variable.name}" is mandatory so in "{variable_mode}" mode ' - f'but family has the higher family mode "{family_mode}"' - ) + 'the variable "{0}" is mandatory so in "{1}" mode but family has the higher family mode "{2}"' + ).format(variable.name, variable_mode, family_mode) raise DictConsistencyError(msg, 36, variable.xmlfiles) variable.mode = variable_mode @@ -289,9 +284,8 @@ class Annotator(Walk): # leader's mode is minimum level if self._has_mode(follower): msg = _( - f'the follower "{follower.name}" is in "{follower_mode}" mode ' - f'but leader have the higher mode "{leader.mode}"' - ) + 'the follower "{0}" is in "{1}" mode but leader have the higher mode "{2}"' + ).format(follower.name, follower_mode, leader.mode) raise DictConsistencyError(msg, 63, follower.xmlfiles) self._set_auto_mode(follower, leader.mode) @@ -323,9 +317,8 @@ class Annotator(Walk): self._set_auto_mode(family, min_variable_mode) if self.modes[family.mode] < self.modes[min_variable_mode]: msg = _( - f'the family "{family.name}" is in "{family.mode}" mode but variables and ' - f'families inside have the higher modes "{min_variable_mode}"' - ) + 'the family "{0}" is in "{1}" mode but variables and families inside have the higher modes "{2}"' + ).format(family.name, family.mode, min_variable_mode) raise DictConsistencyError(msg, 62, family.xmlfiles) def _change_variable_mode( @@ -342,9 +335,8 @@ class Annotator(Walk): if not is_follower and self.modes[variable_mode] < self.modes[family_mode]: if self._has_mode(variable): msg = _( - f'the variable "{variable.name}" is in "{variable_mode}" mode ' - f'but family has the higher family mode "{family_mode}"' - ) + 'the variable "{0}" is in "{1}" mode but family has the higher family mode "{2}"' + ).format(variable.name, variable_mode, family_mode) raise DictConsistencyError(msg, 61, variable.xmlfiles) self._set_auto_mode(variable, family_mode) if not variable.mode: diff --git a/src/rougail/annotator/value.py b/src/rougail/annotator/value.py index 95c5e5946..8511d9302 100644 --- a/src/rougail/annotator/value.py +++ b/src/rougail/annotator/value.py @@ -78,8 +78,8 @@ class Annotator(Walk): # pylint: disable=R0903 raise DictConsistencyError(msg, 68, variable.xmlfiles) if variable.path in self.objectspace.followers and multi != "submulti": msg = _( - f'the follower "{variable.name}" without multi attribute can only have one value' - ) + 'the follower "{0}" without multi attribute can only have one value' + ).format(variable.name) raise DictConsistencyError(msg, 87, variable.xmlfiles) if not variable.default: variable.default = None @@ -94,8 +94,8 @@ class Annotator(Walk): # pylint: disable=R0903 ) elif variable.multi: msg = _( - f'the variable "{variable.name}" is multi but has a non list default value' - ) + 'the variable "{0}" is multi but has a non list default value' + ).format(variable.name) raise DictConsistencyError(msg, 12, variable.xmlfiles) elif variable.path in self.objectspace.followers: self.objectspace.default_multi[variable.path] = variable.default diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index b518d6b7b..6b4413a07 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -190,8 +190,8 @@ class Annotator(Walk): # pylint: disable=R0903 variable.hidden = None if variable.regexp is not None and variable.type != "regexp": msg = _( - f'the variable "{variable.path}" has regexp attribut but has not the "regexp" type' - ) + 'the variable "{0}" has regexp attribut but has not the "regexp" type' + ).format(variable.path) raise DictConsistencyError(msg, 37, variable.xmlfiles) if variable.mandatory is None: variable.mandatory = True @@ -233,8 +233,8 @@ class Annotator(Walk): # pylint: disable=R0903 variable.type = "choice" if variable.choices is not None and variable.type != "choice": msg = _( - f'the variable "{variable.path}" has choices attribut but has not the "choice" type' - ) + 'the variable "{0}" has choices attribut but has not the "choice" type' + ).format(variable.path) raise DictConsistencyError(msg, 11, variable.xmlfiles) if variable.type != "choice": continue @@ -261,6 +261,6 @@ class Annotator(Walk): # pylint: disable=R0903 continue if value not in choices: msg = _( - f'the variable "{variable.path}" has an unvalid default value "{value}" should be in {display_list(choices, separator="or", add_quote=True)}' - ) + 'the variable "{0}" has an unvalid default value "{1}" should be in {2}' + ).format(variable.path, value, display_list(choices, separator="or", add_quote=True)) raise DictConsistencyError(msg, 26, variable.xmlfiles) diff --git a/src/rougail/convert.py b/src/rougail/convert.py index fe71b88f7..270c5e02f 100644 --- a/src/rougail/convert.py +++ b/src/rougail/convert.py @@ -55,7 +55,6 @@ from warnings import warn from tiramisu.error import display_list from .annotator import SpaceAnnotator -from .error import DictConsistencyError from .i18n import _ from .object_model import CONVERT_OPTION # Choice, from .object_model import ( @@ -267,9 +266,8 @@ class Paths: and namespace != option_namespace ): msg = _( - f'A variable or a family located in the "{option_namespace}" namespace ' - f'shall not be used in the "{namespace}" namespace' - ) + 'A variable or a family located in the "{0}" namespace shall not be used in the "{1}" namespace' + ).format(option_namespace, namespace) raise DictConsistencyError(msg, 38, xmlfiles) return option, identifiers @@ -461,7 +459,7 @@ class ParserVariable: return "family" if obj_type in self.variable_types: return "variable" - msg = f"unknown type {obj_type} for {path}" + msg = _("unknown type {0} for {1}").format(obj_type, path) raise DictConsistencyError(msg, 43, [filename]) # in a leadership there is only variable if family_is_leadership: @@ -472,7 +470,7 @@ class ParserVariable: extra_keys = set(obj) - self.variable_attrs if not extra_keys: for key, value in obj.items(): - if isinstance(value, dict) and not self.is_calculation( + if isinstance(value, dict) and key != 'params' and not self.is_calculation( key, value, self.variable_calculations, @@ -1322,7 +1320,7 @@ class RougailConvert(ParserVariable): continue if file_path.name in filenames: raise DictConsistencyError( - _(f"duplicate dictionary file name {file_path.name}"), + _("duplicate dictionary file name {0}").format(file_path.name), 78, [filenames[file_path.name][1]], ) diff --git a/src/rougail/error.py b/src/rougail/error.py index f1d2e882d..90e281ec3 100644 --- a/src/rougail/error.py +++ b/src/rougail/error.py @@ -67,7 +67,7 @@ class DictConsistencyError(Exception): def __init__(self, msg, errno, xmlfiles): if xmlfiles: - msg = _(f"{msg} in {display_xmlfiles(xmlfiles)}") + msg = _("{0} in {1}").format(msg, display_xmlfiles(xmlfiles)) super().__init__(msg) self.errno = errno diff --git a/src/rougail/i18n.py b/src/rougail/i18n.py index aef550db2..b48c09216 100644 --- a/src/rougail/i18n.py +++ b/src/rougail/i18n.py @@ -27,35 +27,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -import gettext -import os -import sys -import locale +from gettext import translation +from pathlib import Path -# Application Name -APP_NAME = "rougail" - -# Traduction dir -APP_DIR = os.path.join(sys.prefix, "share") -LOCALE_DIR = os.path.join(APP_DIR, "locale") - -# Default Lanugage -DEFAULT_LANG = os.environ.get("LANG", "").split(":") -DEFAULT_LANG += ["en_US"] - -languages = [] -lc, encoding = locale.getlocale() -if lc: - languages = [lc] - -languages += DEFAULT_LANG -mo_location = LOCALE_DIR - -gettext.find(APP_NAME, mo_location) -gettext.textdomain(APP_NAME) -# gettext.bind_textdomain_codeset(APP_NAME, "UTF-8") -# gettext.translation(APP_NAME, fallback=True) - -t = gettext.translation(APP_NAME, fallback=True) +t = translation('rougail', str(Path(__file__).parent / 'locale')) _ = t.gettext diff --git a/src/rougail/locale/fr/LC_MESSAGES/rougail.mo b/src/rougail/locale/fr/LC_MESSAGES/rougail.mo new file mode 100644 index 0000000000000000000000000000000000000000..74bc424b54bcc35a3ad7baff09e6f4eb50f41cda GIT binary patch literal 4283 zcmb_fO>f*p7#>OsG(f-jC?F1_l~4}EWz$fpS*QeU($cDFQ)p2SEzzt!yF0-xSJn6f8N<+Manop7(2V=g{uk z4A)DzU&j3h?pJXC_z3>sTHeLj2f#}}djB0T0{#MQ0(U>k*h%0q-~w50 zSAYk1Gxiqn2Ji&%d*D03KY3%m;?`DY$u>@@Hea1r=3Z~=Ju zalii>@EV@K0lo>``vhYz08ay_fGfbez*XP|u(#Ly@jGx1&j+w*9=HG`IUfVB1Ahh1 z0Oz0d>pDP#=g)u_fcu_eYzcTB7z4isc7gk!X6!}a8j#k13M6@Z_JLDi3_J(?0Z9J* z1tfnK_cQh$@D?xu-T__$o;u+DxebI0_AQV?L^`Sqt~(Avxw{VG?=IX2af3#;55S(o z4RaV&vS)Eu7eun>aYLoMC@1Iw1q?K~3$(k7xCNE$Fm6!cE`*Y?xA{O6O0-kSvw{oW z5q*_z@HC5sl?hjx+n(f&kD50dT#LRmxriknY<(d+B{Z#)>oP8_ z?R|G zPVnpK%?3+kM?hcYTR%%G4aztt1V~6#!s*LQ?YH5gkQ~y6B8Fr=l#nuqJLG->uT-W* zvB5hEEI6mZF_T4sFo5+{rB_AZp@UZxg`sliV2i^!rnEPG_zi1A3~NmGOJjMa5m=CC zh0+EQUXw*E41!`}rFh&Eg@_S{8LrEITNacLE3D=xnc=A&OPkIdf1Wcj5Gtjt`WFI5 zF$lcFJuSOFEfQ(sLgmC7hx$IED{Mym!K!warBdi2K{LEv+CW}U7(Hz#3UZ_jt$m<0 zsCE=E%4)%{E}eG)L@W?Iic#R+7YtS-l%6w3B$-u33Qi(J-FhWyp;5@oo*1AgAgHIh zJp_Takxt5ECqGMFPtmvDaDB>1d*aIF)6wzKI?~mVMYO2nEK$1K z;>X*{PMwij7BtDClN&9bZ*-+4VMp=}K6~WY)YT{~ARCu6nJCNW@Sa_9d0q|15;+}8 z8_k+#BS_uaDL%F`S zNi(y6f-p9z_vLA6lq?H_m?<-9a!Q0;YHIcvplDPB8E>DT$O&gXb(igfwBenoCaI)e zN*N93U4AFibv|-Y@MLQfGq&ov8kBgyOYL{K-j3OtLY;4E{*B=Vk#-4pukc~v{7=#; zG6+yd#XSX1Dbev5=CBqD(Mf1L-zc{>X$pg4PtdvAAkH(qP3g1{GQ%}BKZr>|7{-X; z_JvvLJ3XBAqan!<7bDA5_L1jqEK9AR69mO>5^sH3Py=+sxvz9-Vl2jR&iZW_>xOeh znHTAl`ZhZ`0HTbmm>@+R`4l^)kxUOEZc;qa*^#zki14vfoKhrfrwRi;Bl?~BP9wDimDP@Pj7at=w{t~gq2rTPX+!hAI&t}#k8E%)dl*=O9QQfz zL*Wc3nnrG+p6Er`hvx7FYFuf%wOLSUW86~1t_sDJdH7JB1L_%QN*tPT0uS7b*Ivum za5fO=Xx_?^c!+RCUR%9Qy7B#P7*~H*aP3MA5X4$SQ-c8CaEH~+^$~=X?#NBf*6Vv% zKc2d(f%@i2r-gB%;Ke%2&*V8UZC?0OmRY!&gN(sk?@j}9pVT=$;m(WxHnE<0S z8HMP+)O)737fF)ocxOs>6yK4O;Xh=~Yf6tQe)mMkWk48aSV3nCoW81Kgu?LEr7y7R KIN=zfhra=-B{FmX literal 0 HcmV?d00001 diff --git a/src/rougail/locale/fr/LC_MESSAGES/rougail.po b/src/rougail/locale/fr/LC_MESSAGES/rougail.po new file mode 100644 index 000000000..d2a79388a --- /dev/null +++ b/src/rougail/locale/fr/LC_MESSAGES/rougail.po @@ -0,0 +1,166 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +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" +"Last-Translator: \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" +"X-Generator: Poedit 3.5\n" + +#: src/rougail/annotator/family.py:142 +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 +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 +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 +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 +msgid "" +"the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the " +"higher family mode \"{2}\"" +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 +msgid "" +"the follower \"{0}\" is in \"{1}\" mode but leader have the higher mode " +"\"{2}\"" +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 +msgid "" +"the family \"{0}\" is in \"{1}\" mode but variables and families inside have " +"the higher modes \"{2}\"" +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 +msgid "" +"the variable \"{0}\" is in \"{1}\" mode but family has the higher family " +"mode \"{2}\"" +msgstr "" +"la variable \"{0}\" est dans le mode \"{1}\" mais la famille a le mode " +"supérieur \"{2}\"" + +#: src/rougail/annotator/value.py:80 +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 +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 +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 +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 +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 +msgid "" +"A variable or a family located in the \"{0}\" namespace shall not be used in " +"the \"{1}\" namespace" +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 +msgid "unknown type {0} for {1}" +msgstr "type {0} inconnu pour {1}" + +#: src/rougail/convert.py:1323 +msgid "duplicate dictionary file name {0}" +msgstr "nom de fichier {0} de dictionnaire dupliqué" + +#: src/rougail/convert.py:1370 +msgid "Cannot execute annotate multiple time" +msgstr "Ne peut exécuter l'annotation plusieurs fois" + +#: src/rougail/error.py:70 +msgid "{0} in {1}" +msgstr "{0} dans {1}" + +#: src/rougail/structural_commandline/annotator.py:70 +msgid "alternative_name \"{0}\" conflict with \"--help\"" +msgstr "alternative_name \"{0}\" est en conflit avec \"--help\"" + +#: src/rougail/structural_commandline/annotator.py:73 +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 +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 +msgid "" +"negative_description is only available for boolean variable, but \"{0}\" is " +"\"{1}\"" +msgstr "" +"l'attribut negative_description est seulement valide pour des variables " +"\"boolean\", mais \"{0}\" est \"{1}\"" + +#: src/rougail/update/update.py:741 +msgid "not a XML file: {0}" +msgstr "fichier XML invalid : {0}" + +#: src/rougail/utils.py:58 +msgid "" +"invalid variable or family name \"{0}\" must only contains lowercase ascii " +"character, number or _" +msgstr "" +"nom invalide pour la variable ou famille \"{0}\" doit seulement contenir des " +"caractères ascii minuscule, nombre or _" + +#: src/rougail/utils.py:120 +msgid "error in jinja \"{0}\" for the variable \"{1}\": {2}" +msgstr "erreur dans Jinja \"{0}\" pour la variable \"{1}\": {2}" diff --git a/src/rougail/locale/rougail.pot b/src/rougail/locale/rougail.pot new file mode 100644 index 000000000..b810af546 --- /dev/null +++ b/src/rougail/locale/rougail.pot @@ -0,0 +1,117 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2024-10-30 13:21+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" + + +#: src/rougail/annotator/family.py:142 +msgid "default variable mode \"{0}\" is not a valid mode, valid modes are {1}" +msgstr "" + +#: src/rougail/annotator/family.py:148 +msgid "default family mode \"{0}\" is not a valid mode, valid modes are {1}" +msgstr "" + +#: src/rougail/annotator/family.py:180 +msgid "mode \"{0}\" for \"{1}\" is not a valid mode, valid modes are {2}" +msgstr "" + +#: src/rougail/annotator/family.py:184 +msgid "mode \"{0}\" for \"{1}\" is not a valid mode, no modes are available" +msgstr "" + +#: src/rougail/annotator/family.py:248 +msgid "the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the higher family mode \"{2}\"" +msgstr "" + +#: src/rougail/annotator/family.py:286 +msgid "the follower \"{0}\" is in \"{1}\" mode but leader have the higher mode \"{2}\"" +msgstr "" + +#: src/rougail/annotator/family.py:319 +msgid "the family \"{0}\" is in \"{1}\" mode but variables and families inside have the higher modes \"{2}\"" +msgstr "" + +#: src/rougail/annotator/family.py:337 +msgid "the variable \"{0}\" is in \"{1}\" mode but family has the higher family mode \"{2}\"" +msgstr "" + +#: src/rougail/annotator/value.py:80 +msgid "the follower \"{0}\" without multi attribute can only have one value" +msgstr "" + +#: src/rougail/annotator/value.py:96 +msgid "the variable \"{0}\" is multi but has a non list default value" +msgstr "" + +#: src/rougail/annotator/variable.py:192 +msgid "the variable \"{0}\" has regexp attribut but has not the \"regexp\" type" +msgstr "" + +#: src/rougail/annotator/variable.py:235 +msgid "the variable \"{0}\" has choices attribut but has not the \"choice\" type" +msgstr "" + +#: src/rougail/annotator/variable.py:263 +msgid "the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}" +msgstr "" + +#: src/rougail/convert.py:268 +msgid "A variable or a family located in the \"{0}\" namespace shall not be used in the \"{1}\" namespace" +msgstr "" + +#: src/rougail/convert.py:462 +msgid "unknown type {0} for {1}" +msgstr "" + +#: src/rougail/convert.py:1323 +msgid "duplicate dictionary file name {0}" +msgstr "" + +#: src/rougail/convert.py:1370 +msgid "Cannot execute annotate multiple time" +msgstr "" + +#: src/rougail/error.py:70 +msgid "{0} in {1}" +msgstr "" + +#: src/rougail/structural_commandline/annotator.py:70 +msgid "alternative_name \"{0}\" conflict with \"--help\"" +msgstr "" + +#: src/rougail/structural_commandline/annotator.py:73 +msgid "conflict alternative_name \"{0}\": \"{1}\" and \"{2}\"" +msgstr "" + +#: src/rougail/structural_commandline/annotator.py:96 +msgid "negative_description is mandatory for boolean variable, but \"{0}\" hasn't" +msgstr "" + +#: src/rougail/structural_commandline/annotator.py:105 +msgid "negative_description is only available for boolean variable, but \"{0}\" is \"{1}\"" +msgstr "" + +#: src/rougail/update/update.py:741 +msgid "not a XML file: {0}" +msgstr "" + +#: src/rougail/utils.py:58 +msgid "invalid variable or family name \"{0}\" must only contains lowercase ascii character, number or _" +msgstr "" + +#: src/rougail/utils.py:120 +msgid "error in jinja \"{0}\" for the variable \"{1}\": {2}" +msgstr "" + diff --git a/src/rougail/structural_commandline/annotator.py b/src/rougail/structural_commandline/annotator.py index 8b0288989..942fb2e84 100644 --- a/src/rougail/structural_commandline/annotator.py +++ b/src/rougail/structural_commandline/annotator.py @@ -67,12 +67,12 @@ class Annotator(Walk): for letter in alternative_name: all_letters += letter if all_letters == "h": - msg = _(f'alternative_name "{alternative_name}" conflict with "--help"') + msg = _('alternative_name "{0}" conflict with "--help"').format(alternative_name) raise DictConsistencyError(msg, 202, variable.xmlfiles) if all_letters in self.alternative_names: msg = _( - f'conflict alternative_name "{alternative_name}": "{variable_path}" and "{self.alternative_names[all_letters]}"' - ) + 'conflict alternative_name "{0}": "{1}" and "{2}"' + ).format(alternative_name, variable_path, self.alternative_names[all_letters]) raise DictConsistencyError(msg, 202, variable.xmlfiles) self.alternative_names[alternative_name] = variable_path @@ -94,8 +94,8 @@ class Annotator(Walk): if variable.type == "boolean" and not self.objectspace.add_extra_options: raise DictConsistencyError( _( - f'negative_description is mandatory for boolean variable, but "{variable.path}" hasn\'t' - ), + 'negative_description is mandatory for boolean variable, but "{0}" hasn\'t' + ).format(variable.path), 200, variable.xmlfiles, ) @@ -103,8 +103,8 @@ class Annotator(Walk): if variable.type != "boolean": raise DictConsistencyError( _( - f'negative_description is only available for boolean variable, but "{variable.path}" is "{variable.type}"' - ), + 'negative_description is only available for boolean variable, but "{0}" is "{1}"' + ).format(variable.path, variable.type), 201, variable.xmlfiles, ) diff --git a/src/rougail/update/update.py b/src/rougail/update/update.py index 3b080008a..32803852d 100644 --- a/src/rougail/update/update.py +++ b/src/rougail/update/update.py @@ -738,7 +738,7 @@ class RougailUpgrade: parser = XMLParser(remove_blank_text=True) document = parse(xmlsrc, parser) except XMLSyntaxError as err: - raise Exception(_(f"not a XML file: {err}")) from err + raise Exception(_("not a XML file: {0}").format(err)) from err root = document.getroot() search_function_name = get_function_name( root.attrib.get("version", "1") diff --git a/src/rougail/utils.py b/src/rougail/utils.py index 416a69987..277e80e2f 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -56,9 +56,8 @@ def valid_variable_family_name( match = NAME_REGEXP.search(name) if not match: msg = _( - f'invalid variable or family name "{name}" must only contains ' - "lowercase ascii character, number or _" - ) + 'invalid variable or family name "{0}" must only contains lowercase ascii character, number or _' + ).format(name) raise DictConsistencyError(msg, 76, xmlfiles) @@ -119,8 +118,8 @@ def get_jinja_variable_to_param( variables.add(recurse_getattr(g)) except TemplateSyntaxError as err: msg = _( - f'error in jinja "{jinja_text}" for the variable "{ current_path }": {err}' - ) + 'error in jinja "{0}" for the variable "{1}": {2}' + ).format(jinja_text, current_path, err) raise DictConsistencyError(msg, 39, xmlfiles) from err variables = list(variables) variables.sort(reverse=True) diff --git a/tests/dictionaries/04_0type_param/dictionaries/rougail/00-base.yml b/tests/dictionaries/04_0type_param/dictionaries/rougail/00-base.yml index 10ac1e91d..07492891b 100644 --- a/tests/dictionaries/04_0type_param/dictionaries/rougail/00-base.yml +++ b/tests/dictionaries/04_0type_param/dictionaries/rougail/00-base.yml @@ -2,7 +2,7 @@ version: '1.1' int: description: A limited number - type: number + default: 10 params: min_number: 0 max_number: 100 diff --git a/tests/dictionaries/04_0type_param/makedict/after.json b/tests/dictionaries/04_0type_param/makedict/after.json index c13b17de0..cc1f4e879 100644 --- a/tests/dictionaries/04_0type_param/makedict/after.json +++ b/tests/dictionaries/04_0type_param/makedict/after.json @@ -1,6 +1,6 @@ { "rougail.int": { "owner": "default", - "value": null + "value": 10 } } diff --git a/tests/dictionaries/04_0type_param/makedict/base.json b/tests/dictionaries/04_0type_param/makedict/base.json index f6f915662..5c61db99c 100644 --- a/tests/dictionaries/04_0type_param/makedict/base.json +++ b/tests/dictionaries/04_0type_param/makedict/base.json @@ -1,3 +1,3 @@ { - "rougail.int": null + "rougail.int": 10 } diff --git a/tests/dictionaries/04_0type_param/makedict/before.json b/tests/dictionaries/04_0type_param/makedict/before.json index c13b17de0..cc1f4e879 100644 --- a/tests/dictionaries/04_0type_param/makedict/before.json +++ b/tests/dictionaries/04_0type_param/makedict/before.json @@ -1,6 +1,6 @@ { "rougail.int": { "owner": "default", - "value": null + "value": 10 } } diff --git a/tests/dictionaries/04_0type_param/makedict/mandatory.json b/tests/dictionaries/04_0type_param/makedict/mandatory.json index 448b0b3c1..0637a088a 100644 --- a/tests/dictionaries/04_0type_param/makedict/mandatory.json +++ b/tests/dictionaries/04_0type_param/makedict/mandatory.json @@ -1 +1 @@ -["rougail.int"] \ No newline at end of file +[] \ No newline at end of file diff --git a/tests/dictionaries/04_0type_param/tiramisu/base.py b/tests/dictionaries/04_0type_param/tiramisu/base.py index 3fa961ab2..8ffa5fe31 100644 --- a/tests/dictionaries/04_0type_param/tiramisu/base.py +++ b/tests/dictionaries/04_0type_param/tiramisu/base.py @@ -10,6 +10,6 @@ except: ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("standard") ALLOWED_LEADER_PROPERTIES.add("advanced") -option_2 = IntOption(name="int", doc="A limited number", min_number=0, max_number=100, properties=frozenset({"basic", "mandatory"}), informations={'type': 'number'}) -optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2], properties=frozenset({"basic"})) +option_2 = IntOption(name="int", doc="A limited number", default=10, min_number=0, max_number=100, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'}) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2], properties=frozenset({"standard"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/04_0type_param/tiramisu/multi.py b/tests/dictionaries/04_0type_param/tiramisu/multi.py index 5b1cb4252..737eea338 100644 --- a/tests/dictionaries/04_0type_param/tiramisu/multi.py +++ b/tests/dictionaries/04_0type_param/tiramisu/multi.py @@ -10,10 +10,10 @@ except: ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("standard") ALLOWED_LEADER_PROPERTIES.add("advanced") -option_3 = IntOption(name="int", doc="A limited number", min_number=0, max_number=100, properties=frozenset({"basic", "mandatory"}), informations={'type': 'number'}) -optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3], properties=frozenset({"basic"})) -optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"})) -option_6 = IntOption(name="int", doc="A limited number", min_number=0, max_number=100, properties=frozenset({"basic", "mandatory"}), informations={'type': 'number'}) -optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_6], properties=frozenset({"basic"})) -optiondescription_4 = OptionDescription(name="2", doc="2", children=[optiondescription_5], properties=frozenset({"basic"})) +option_3 = IntOption(name="int", doc="A limited number", default=10, min_number=0, max_number=100, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'}) +optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3], properties=frozenset({"standard"})) +optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"})) +option_6 = IntOption(name="int", doc="A limited number", default=10, min_number=0, max_number=100, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'}) +optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_6], properties=frozenset({"standard"})) +optiondescription_4 = OptionDescription(name="2", doc="2", children=[optiondescription_5], properties=frozenset({"standard"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_4]) diff --git a/tests/dictionaries/04_0type_param/tiramisu/no_namespace.py b/tests/dictionaries/04_0type_param/tiramisu/no_namespace.py index 07b2d0e77..60d68750c 100644 --- a/tests/dictionaries/04_0type_param/tiramisu/no_namespace.py +++ b/tests/dictionaries/04_0type_param/tiramisu/no_namespace.py @@ -6,5 +6,5 @@ load_functions('tests/dictionaries/../eosfunc/test.py') ALLOWED_LEADER_PROPERTIES.add("basic") ALLOWED_LEADER_PROPERTIES.add("standard") ALLOWED_LEADER_PROPERTIES.add("advanced") -option_1 = IntOption(name="int", doc="A limited number", min_number=0, max_number=100, properties=frozenset({"basic", "mandatory"}), informations={'type': 'number'}) +option_1 = IntOption(name="int", doc="A limited number", default=10, min_number=0, max_number=100, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'}) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])