From bf41ee013ccd3717482e1ab5b107174a36bbc077 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Thu, 7 Jan 2021 18:02:09 +0100 Subject: [PATCH] bimtester: improve step translation --- .../bimtester/features/steps/attributes_eleclasses.py | 11 +++++++---- .../bimtester/features/steps/attributes_psets.py | 5 ++++- src/ifcbimtester/bimtester/features/steps/ifcdata.py | 6 +++++- .../bimtester/features/steps/ifcdata_de.py | 6 +++++- .../bimtester/features/steps/ifcdata_fr.py | 6 +++++- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/ifcbimtester/bimtester/features/steps/attributes_eleclasses.py b/src/ifcbimtester/bimtester/features/steps/attributes_eleclasses.py index 6a6dda335e..32246796c4 100644 --- a/src/ifcbimtester/bimtester/features/steps/attributes_eleclasses.py +++ b/src/ifcbimtester/bimtester/features/steps/attributes_eleclasses.py @@ -6,9 +6,12 @@ from utils import IfcFile from utils import switch_locale +the_lang = "en" + + @step("there are no {ifc_class} elements because {reason}") def step_impl(context, ifc_class, reason): - switch_locale(context.localedir, "en") + switch_locale(context.localedir, the_lang) aem.no_eleclass_because_reason( context, ifc_class, @@ -18,7 +21,7 @@ def step_impl(context, ifc_class, reason): @step('all {ifc_class} elements class attributes have a value') def step_impl(context, ifc_class): - switch_locale(context.localedir, "en") + switch_locale(context.localedir, the_lang) aem.eleclass_have_class_attributes_with_a_value( context, ifc_class @@ -27,7 +30,7 @@ def step_impl(context, ifc_class): @step('all {ifc_class} elements have a name given') def step_impl(context, ifc_class): - switch_locale(context.localedir, "en") + switch_locale(context.localedir, the_lang) aem.eleclass_has_name_with_a_value( context, ifc_class @@ -36,7 +39,7 @@ def step_impl(context, ifc_class): @step('all {ifc_class} elements have a description given') def step_impl(context, ifc_class): - switch_locale(context.localedir, "en") + switch_locale(context.localedir, the_lang) aem.eleclass_has_description_with_a_value( context, ifc_class diff --git a/src/ifcbimtester/bimtester/features/steps/attributes_psets.py b/src/ifcbimtester/bimtester/features/steps/attributes_psets.py index 3c7efd01ee..7eaa4cc596 100644 --- a/src/ifcbimtester/bimtester/features/steps/attributes_psets.py +++ b/src/ifcbimtester/bimtester/features/steps/attributes_psets.py @@ -6,9 +6,12 @@ from utils import IfcFile from utils import switch_locale +the_lang = "en" + + @step("all {ifc_class} elements have an {aproperty} property in the {pset} pset") def step_impl(context, ifc_class, aproperty, pset): - switch_locale(context.localedir, "en") + switch_locale(context.localedir, the_lang) apm.eleclass_has_property_in_pset( context, ifc_class, diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata.py b/src/ifcbimtester/bimtester/features/steps/ifcdata.py index af7bba824c..66d004c163 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata.py @@ -6,6 +6,10 @@ from ifcdata_methods import assert_schema from utils import IfcFile from utils import switch_locale + +the_lang = "en" + + @step('The IFC schema "{schema}" must be provided') def step_impl(context, schema): try: @@ -38,7 +42,7 @@ def step_impl(context): @step("IFC data must use the {schema} schema") def step_impl(context, schema): - switch_locale(context.localedir, "en") + switch_locale(context.localedir, the_lang) assert_schema(context, schema) diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py b/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py index 58ede99a1b..4fcc52088a 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py @@ -3,7 +3,11 @@ from behave import step from ifcdata_methods import assert_schema from utils import switch_locale + +the_lang = "de" + + @step("Die IFC Daten müssen das {schema} Schema benutzen") def step_impl(context, schema): - switch_locale(context.localedir, "de") + switch_locale(context.localedir, the_lang) assert_schema(context, schema) diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py b/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py index 1172cefdbc..bd68ba2cd3 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py @@ -3,7 +3,11 @@ from behave import step from ifcdata_methods import assert_schema from utils import switch_locale + +the_lang = "fr" + + @step("Les données IFC doivent utiliser le schéma {schema}") def step_impl(context, schema): - switch_locale(context.localedir, "fr") + switch_locale(context.localedir, the_lang) assert_schema(context, schema)