From 70efb3d8ad73da871a83a7be165bdc381ddc31db Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 5 Oct 2025 21:25:12 +0200 Subject: [PATCH] fix: translation + tests --- src/rougail/user_data_environment/config.py | 20 +++++++++---- src/rougail/user_data_environment/data.py | 5 ++++ src/rougail/user_data_environment/i18n.py | 27 ++++++++++++++++++ .../rougail_user_data_environment.mo | Bin 0 -> 1206 bytes tests/errors/results/01_wrong_type.env | 2 +- tests/errors/results/04_value_secret.env | 2 +- .../errors/all.json | 6 ++++ .../errors/mandatories.json | 6 ++++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 4 +++ .../makedict/mandatories.json | 4 +++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 4 +++ .../errors/all.json | 4 +++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 6 ++++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 4 +++ .../makedict/mandatories.json | 4 +++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 4 +++ .../errors/all.json | 7 +++++ .../errors/mandatories.json | 6 ++++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 3 ++ .../makedict/mandatories.json | 3 ++ 90 files changed, 311 insertions(+), 8 deletions(-) create mode 100644 src/rougail/user_data_environment/i18n.py create mode 100644 src/rougail/user_data_environment/locale/fr/LC_MESSAGES/rougail_user_data_environment.mo create mode 100644 tests/results/test/04_5disabled_calculation_variable10/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable10/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable10/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_variable10/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_variable10/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_variable10/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable10/makedict/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable5/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable5/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable5/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_variable5/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_variable5/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_variable5/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable5/makedict/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable6/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable6/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable6/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_variable6/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_variable6/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_variable6/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable6/makedict/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable7/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable7/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable7/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_variable7/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_variable7/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_variable7/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable7/makedict/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable8/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable8/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable8/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_variable8/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_variable8/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_variable8/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable8/makedict/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable9/errors/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable9/errors/mandatories.json create mode 100644 tests/results/test/04_5disabled_calculation_variable9/file/all.env create mode 100644 tests/results/test/04_5disabled_calculation_variable9/file/all_exclude.env create mode 100644 tests/results/test/04_5disabled_calculation_variable9/file/mandatories.env create mode 100644 tests/results/test/04_5disabled_calculation_variable9/makedict/all.json create mode 100644 tests/results/test/04_5disabled_calculation_variable9/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable10/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable5/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable6/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable7/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable8/makedict/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/errors/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/errors/mandatories.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/file/all.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/file/all_exclude.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/file/mandatories.env create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/makedict/all.json create mode 100644 tests/results/test_namespace/04_5disabled_calculation_variable9/makedict/mandatories.json diff --git a/src/rougail/user_data_environment/config.py b/src/rougail/user_data_environment/config.py index 7f01d52..e97594b 100644 --- a/src/rougail/user_data_environment/config.py +++ b/src/rougail/user_data_environment/config.py @@ -22,24 +22,32 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +from .i18n import _ + + def get_rougail_config( *, backward_compatibility=True, ) -> dict: - options = """ + options = f""" environment: - description: Define values from the environment + description: {_("Configuration loading environment variables")} disabled: jinja: | - {% if step.user_data is propertyerror or 'environment' not in step.user_data %} + {{% if _.step.user_data is propertyerror or 'environment' not in _.step.user_data %}} disabled - {% endif %} + {{% endif %}} + default_environment_name: - description: Name of the default environment prefix + description: {_("Name of the default environment prefix")} default: rougail disabled: - variable: main_namespace + variable: __.main_namespace when_not: null + + with_secrets: + description: {_("Environnement variables may contain secrets")} + default: true """ return { "name": "environment", diff --git a/src/rougail/user_data_environment/data.py b/src/rougail/user_data_environment/data.py index 5e403b4..d968b96 100644 --- a/src/rougail/user_data_environment/data.py +++ b/src/rougail/user_data_environment/data.py @@ -45,6 +45,10 @@ class RougailUserDataEnvironment: self.rougailconfig = rougailconfig if "environment" not in user_data: raise ExtentionError("environment is not set in step.user_data") + if "environment.with_secrets" in self.rougailconfig: + self.with_secrets = self.rougailconfig["environment.with_secrets"] + else: + self.with_secrets = True self.errors = [] self.warnings = [] @@ -59,6 +63,7 @@ class RougailUserDataEnvironment: "options": { "multi_separator": ",", "needs_convert": True, + "allow_secrets_variables": self.with_secrets, }, } ] diff --git a/src/rougail/user_data_environment/i18n.py b/src/rougail/user_data_environment/i18n.py new file mode 100644 index 0000000..64d109b --- /dev/null +++ b/src/rougail/user_data_environment/i18n.py @@ -0,0 +1,27 @@ +"""Internationalisation utilities +Silique (https://www.silique.fr) +Copyright (C) 2025 + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by the +Free Software Foundation, either version 3 of the License, or (at your +option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see . +""" + +from gettext import translation +from pathlib import Path + +t = translation( + "rougail_user_data_environment", str(Path(__file__).parent / "locale"), fallback=True +) + +_ = t.gettext + diff --git a/src/rougail/user_data_environment/locale/fr/LC_MESSAGES/rougail_user_data_environment.mo b/src/rougail/user_data_environment/locale/fr/LC_MESSAGES/rougail_user_data_environment.mo new file mode 100644 index 0000000000000000000000000000000000000000..725ca6bba8a87b5c7445be3d4c4f65d231a747dd GIT binary patch literal 1206 zcmc(d&2G~`5XZMrIG7t}4x>m=L~-hrR;`S<00mV_p+W(1-P+@HD|^@MN7C@|3c#iB zKzWTm16Q5`aYN$oI5ce!+z=~`|K6F|ow4Wl{rcjOz`6>%0qeuA!QR7~^#!&JJD%w` z=q=d7f)EV74IM&1LVrPjLR09EORcV47UB-}2hdN@Bj{)7%|+Y+#a7@|Abq-;KALr< zmHG3L(S;fYE4?zBN+WZnhs1iMtkD%~Pa|oS+$-6Mt=6mgyq_vLq0DG6l_tlTW$(l@ zSuvS{{6168g$$)XcWZ6AP=}(Bl`1Eso9rq$PkT%fZH(Dw(s3IY@3W>c(^#S%Zzv!D zvy@9OsdJ{;&RuebI`5JX9a4^z9?4SW;?F1i>pHvE9B}62?L25aw7zSP4Yha3-BR%iAp6*k)0 z-r1U0>2;F`qx2Y9Jebrd;`z|8)FozepR#>v9s36_2T$V7d0tbiU>k4g%rs+9X>(8c z=qYOk51hvjCn?pFA^YaCZatx1cRhL?&k~v*cMa#t)4lFSBrc%D)3U=BmYm%jB+8d& zGiy!90RC}S5qyKj*tvql;Ek!UJ9CNN*+A9 zLH{RTy#-Tx8V78Z(!pf`;nG<5CNPamz!w;}-cs