diff --git a/machine/corpora/paratext_project_settings.py b/machine/corpora/paratext_project_settings.py index b932b214..04820cf5 100644 --- a/machine/corpora/paratext_project_settings.py +++ b/machine/corpora/paratext_project_settings.py @@ -22,6 +22,8 @@ class ParatextProjectSettings: biblical_terms_file_name: str language_code: Optional[str] translation_type: str + normalization_form: str + language: str visibility: Optional[str] = None parent_guid: Optional[str] = None parent_name: Optional[str] = None diff --git a/machine/corpora/paratext_project_settings_parser_base.py b/machine/corpora/paratext_project_settings_parser_base.py index ca09971d..73d51142 100644 --- a/machine/corpora/paratext_project_settings_parser_base.py +++ b/machine/corpora/paratext_project_settings_parser_base.py @@ -100,6 +100,9 @@ def parse(self) -> ParatextProjectSettings: parent_guid = translation_info_setting_parts[2] if translation_info_setting_parts[2] != "" else None visibility: Optional[str] = settings_tree.getroot().findtext("Visibility") + normalization_form: str = settings_tree.getroot().findtext("NormalizationForm", "Undefined") + + language: str = settings_tree.getroot().findtext("Language", "") settings = ParatextProjectSettings( guid, @@ -116,6 +119,8 @@ def parse(self) -> ParatextProjectSettings: parts[2], language_code, translation_type, + normalization_form, + language, visibility, parent_guid, parent_name, diff --git a/tests/corpora/test_paratext_project_settings.py b/tests/corpora/test_paratext_project_settings.py index fc607410..d3fe5812 100644 --- a/tests/corpora/test_paratext_project_settings.py +++ b/tests/corpora/test_paratext_project_settings.py @@ -129,5 +129,7 @@ def _create_settings(file_name_form: str) -> ParatextProjectSettings: "BiblicalTerms.xml", "en", "Standard", + "Undefined", + "English", "Public", ) diff --git a/tests/corpora/test_paratext_project_settings_parser.py b/tests/corpora/test_paratext_project_settings_parser.py index 141f826b..62d66b57 100644 --- a/tests/corpora/test_paratext_project_settings_parser.py +++ b/tests/corpora/test_paratext_project_settings_parser.py @@ -25,6 +25,12 @@ def test_translation_info_specified() -> None: assert settings.parent_guid == "22222222222222222222222222222222" +def test_normalization_form_default() -> None: + settings = _create_settings() + + assert settings.normalization_form == "Undefined" + + def _create_settings(additional_settings_xml: str = ""): files = { "Settings.xml": ( diff --git a/tests/testutils/memory_paratext_project_file_handler.py b/tests/testutils/memory_paratext_project_file_handler.py index 8916e6cd..be6692a5 100644 --- a/tests/testutils/memory_paratext_project_file_handler.py +++ b/tests/testutils/memory_paratext_project_file_handler.py @@ -50,6 +50,8 @@ def __init__( biblical_terms_file_name: str = "ProjectBiblicalTerms.xml", language_code: str = "en", translation_type: str = "Standard", + normalization_form: str = "Undefined", + language: str = "", parent_guid: Optional[str] = None, parent_name: Optional[str] = None, ): @@ -69,6 +71,8 @@ def __init__( biblical_terms_file_name, language_code, translation_type, + normalization_form, + language, parent_guid, parent_name, )