diff --git a/CHANGELOG.md b/CHANGELOG.md index bc262110..9585281e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added - Answer responses for Forms +- Language_code field on imports and exports +### Removed +- Locale field on exports --> ## v1.4.0 - 2024-12-18 diff --git a/home/export_content_pages.py b/home/export_content_pages.py index 28427297..e31f0012 100644 --- a/home/export_content_pages.py +++ b/home/export_content_pages.py @@ -72,7 +72,6 @@ class ExportRow: tags: str = "" quick_replies: str = "" triggers: str = "" - locale: str = "" next_prompt: str = "" buttons: str = "" image_link: str = "" @@ -80,6 +79,7 @@ class ExportRow: media_link: str = "" related_pages: str = "" footer: str = "" + language_code: str = "" @classmethod def headings(cls) -> list[str]: @@ -203,8 +203,6 @@ def _export_content_page(self, page: ContentPage, structure: str) -> None: Export a ContentPage. FIXME: - * The locale should be a language code rather than a language name to - make importing less messy. * We should use the parent slug (which is expected to be unique per locale (probably?)) instead of the parent title. """ @@ -228,8 +226,8 @@ def _export_content_page(self, page: ContentPage, structure: str) -> None: tags=self._comma_sep_qs(page.tags.all()), quick_replies=self._comma_sep_qs(page.quick_replies.all()), triggers=self._comma_sep_qs(page.triggers.all()), - locale=str(page.locale), related_pages=self._comma_sep_qs(self._related_pages(page)), + language_code=page.locale.language_code, ) self.rows.append(row) message_bodies = list( @@ -260,8 +258,6 @@ def _export_cpi(self, page: ContentPageIndex, structure: str) -> None: Export a ContentPageIndex. FIXME: - * The locale should be a language code rather than a language name to - make importing less messy. * We should use the parent slug (which is expected to be unique per locale (probably?)) instead of the parent title. """ @@ -272,7 +268,7 @@ def _export_cpi(self, page: ContentPageIndex, structure: str) -> None: parent=self._parent_title(page), web_title=page.title, translation_tag=str(page.translation_key), - locale=str(page.locale), + language_code=page.locale.language_code, ) self.rows.append(row) @@ -353,7 +349,6 @@ def _set_xlsx_styles(wb: Workbook, sheet: Worksheet) -> None: "tags": 118, "quick_replies": 118, "triggers": 118, - "locale": 118, "next_prompt": 118, "buttons": 118, "image_link": 118, @@ -361,6 +356,7 @@ def _set_xlsx_styles(wb: Workbook, sheet: Worksheet) -> None: "media_link": 118, "related": 118, "footer": 118, + "language_code": 118, } for index, column_width in enumerate(column_widths_in_pts.values(), 2): diff --git a/home/import_content_pages.py b/home/import_content_pages.py index 65725f6b..6c6aca0b 100644 --- a/home/import_content_pages.py +++ b/home/import_content_pages.py @@ -11,9 +11,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError # type: ignore from taggit.models import Tag # type: ignore from treebeard.exceptions import NodeAlreadySaved # type: ignore -from wagtail.blocks import ( # type: ignore - StructValue, # type: ignore -) +from wagtail.blocks import StructValue # type: ignore from wagtail.coreutils import get_content_languages # type: ignore from wagtail.models import Locale, Page # type: ignore from wagtail.models.sites import Site # type: ignore @@ -99,14 +97,14 @@ def process_rows(self, rows: list["ContentRow"]) -> None: for i, row in enumerate(rows, start=2): try: if row.is_page_index: - if self.locale and row.locale != self.locale.get_display_name(): + prev_locale = self._get_locale_from_row(row) + if self.locale and self.locale != prev_locale: # This page index isn't for the locale we're importing, so skip it. continue self.create_content_page_index_from_row(row) - prev_locale = self.locale_from_display_name(row.locale) elif row.is_content_page: self.create_shadow_content_page_from_row(row, i) - prev_locale = self.locale_from_display_name(row.locale) + prev_locale = self._get_locale_from_row(row) elif row.is_variation_message: self.add_variation_to_shadow_content_page_from_row(row, prev_locale) else: @@ -117,6 +115,15 @@ def process_rows(self, rows: list["ContentRow"]) -> None: e.locale = row.locale raise e + def _get_locale_from_row(self, row: "ContentRow") -> Locale: + if row.language_code: + try: + return Locale.objects.get(language_code=row.language_code) + except Locale.DoesNotExist: + raise ImportException(f"Language not found: {row.language_code}") + else: + return self.locale_from_display_name(row.locale) + def save_pages(self) -> None: for i, page in enumerate(self.shadow_pages.values()): if self.locale and page.locale != self.locale: @@ -242,7 +249,7 @@ def default_locale(self) -> Locale: return site.root_page.locale def create_content_page_index_from_row(self, row: "ContentRow") -> None: - locale = self.locale_from_display_name(row.locale) + locale = self._get_locale_from_row(row) try: index = ContentPageIndex.objects.get(slug=row.slug, locale=locale) except ContentPageIndex.DoesNotExist: @@ -252,7 +259,6 @@ def create_content_page_index_from_row(self, row: "ContentRow") -> None: # but optional for the default locale. if row.translation_tag or locale != self.default_locale(): index.translation_key = row.translation_tag - locale = self.locale_from_display_name(row.locale) try: with contextlib.suppress(NodeAlreadySaved): self.home_page(locale).add_child(instance=index) @@ -268,7 +274,7 @@ def create_content_page_index_from_row(self, row: "ContentRow") -> None: def create_shadow_content_page_from_row( self, row: "ContentRow", row_num: int ) -> None: - locale = self.locale_from_display_name(row.locale) + locale = self._get_locale_from_row(row) page = ShadowContentPage( row_num=row_num, slug=row.slug, @@ -738,6 +744,7 @@ class ContentRow: media_link: str = "" related_pages: list[str] = field(default_factory=list) footer: str = "" + language_code: str = "" @classmethod def from_flat(cls, row: dict[str, str], row_num: int) -> "ContentRow": diff --git a/home/tests/import-export-data/content2.csv b/home/tests/import-export-data/content2.csv index e60670ad..3ca9d450 100644 --- a/home/tests/import-export-data/content2.csv +++ b/home/tests/import-export-data/content2.csv @@ -1,5 +1,5 @@ -structure,message,page_id,Slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,4,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,,a0b85075-d01b-46bf-8997-8591e87ba171,,,,English,,,,,,, +structure,message,page_id,Slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,4,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,,a0b85075-d01b-46bf-8997-8591e87ba171,,,,,,,,,,,en Sub 1.1,1,5,main-menu-first-time-user,Main Menu,main menu first time user,,,main menu first time user,"*Welcome to HealthAlert* 🌍 This is a messaging service created by the _*World Health Organization*_ *(WHO)* that provides information on COVID-19 as well as emergency resources for disease outbreaks, natural, and man-made disasters. @@ -12,12 +12,12 @@ This is a messaging service created by the World Health Organization (WHO) that You can return to this main menu at any time by replying 🏠 -Choose what you'd like to know more about by tapping a button below ⬇️",,,5892bccd-8025-419d-9a8e-a6a37b755dbf,menu,"Self-help🌬️, Settings⚙️, Health Info🏥",Main menu🏠,English,,[],,,,, +Choose what you'd like to know more about by tapping a button below ⬇️",,,5892bccd-8025-419d-9a8e-a6a37b755dbf,menu,"Self-help🌬️, Settings⚙️, Health Info🏥",Main menu🏠,,[],,,,,,en Sub 1.1.1,1,6,health-info,main menu first time user,health info,,,health info,"*Health information* 🏥 Get information and advice from WHO by tapping on a button below ⬇️",,UTILITY,[],,,,[],Health Info SMS Title,*Health Info SMS Body*,Health Info USSD Title,*Health Info USSD Body*,health info,"*Health information* 🏥 -Get information and advice from WHO by tapping on a button below ⬇️",,,c9d6309e-173f-4c1d-bbaf-440b1fd4415f,health_info,,,English,,[],,,,, +Get information and advice from WHO by tapping on a button below ⬇️",,,c9d6309e-173f-4c1d-bbaf-440b1fd4415f,health_info,,,,[],,,,,,en Sub 1.1.2,1,7,self-help,main menu first time user,self-help,,,self-help,"*Self-help programs* 🌬️ Reply with a number to take part in a *free* self-help program created by WHO. @@ -32,4 +32,4 @@ Reply with a number to take part in a *free* self-help program created by WHO. 1. Quit tobacco 🚭 _Stop smoking with the help of a guided, 42-day program._ 2. Manage your stress 🧘🏽‍♀️ -_Learn how to cope with stress and improve your wellbeing._",,,3e5d77f7-4d34-430d-aad7-d9ca01f79732,self_help,,,English,,[],,,,, \ No newline at end of file +_Learn how to cope with stress and improve your wellbeing._",,,3e5d77f7-4d34-430d-aad7-d9ca01f79732,self_help,,,,[],,,,,,en diff --git a/home/tests/import-export-data/contentpage_index_required_fields.csv b/home/tests/import-export-data/contentpage_index_required_fields.csv index 9e3b02ec..f727c63e 100644 --- a/home/tests/import-export-data/contentpage_index_required_fields.csv +++ b/home/tests/import-export-data/contentpage_index_required_fields.csv @@ -1,2 +1,2 @@ -message,slug,parent,web_title,locale -0,main-menu,,Main Menu,English \ No newline at end of file +message,slug,parent,web_title,language_code +0,main-menu,,Main Menu,en diff --git a/home/tests/import-export-data/contentpage_required_fields.csv b/home/tests/import-export-data/contentpage_required_fields.csv index 8c305f0d..c8594f5e 100644 --- a/home/tests/import-export-data/contentpage_required_fields.csv +++ b/home/tests/import-export-data/contentpage_required_fields.csv @@ -1,4 +1,4 @@ -message,slug,parent,web_title,locale -0,main_menu,,Main Menu,English -1,first_time_user,Main Menu,main menu first time user,English -1,health_info,main menu first time user,health info,English \ No newline at end of file +message,slug,parent,web_title,language_code +0,main_menu,,Main Menu,en +1,first_time_user,Main Menu,main menu first time user,en +1,health_info,main menu first time user,health info,en diff --git a/home/tests/import-export-data/exported_content_20230911-variations-linked-page.csv b/home/tests/import-export-data/exported_content_20230911-variations-linked-page.csv index cdffe6fc..67b3857e 100644 --- a/home/tests/import-export-data/exported_content_20230911-variations-linked-page.csv +++ b/home/tests/import-export-data/exported_content_20230911-variations-linked-page.csv @@ -1,12 +1,12 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,example_values,footer -Menu 1,0,5,appointment-reminders,,Appointment reminders,,,,,,,,,,,,,,,,,,8cff04aa-cf08-4120-88b4-e2269b7d5d80,,,,English,,,,,,,, -Menu 2,0,6,stage-based-messages,,Stage-based messages,,,,,,,,,,,,,,,,,,5f2d9e63-f047-41ab-921a-c5ca7c04d643,,,,English,,,,,,,, -Menu 3,0,7,health-info-messages,,Health info messages,,,,,,,,,,,,,,,,,,3db069a4-7112-4e66-a9a2-f35c6c18055a,,,,English,,,,,,,, -Menu 4,0,17,whatsapp-template-testing,,whatsapp template testing,,,,,,,,,,,,,,,,,,5f7221f4-146a-48c2-b2e3-c8491aaead9d,,,,English,,,,,,,, -Menu 5,0,164,import-export,,Import Export,,,,,,,,,,,,,,,,,,497bdc1f-43fc-4925-80a1-e68cb942faa4,,,,English,,,,,,,, -Sub 5.1,1,165,cp-import-export,Import Export,CP-Import/export,,,WA import export data,Message 1 contains an image,,,,,[],,,,,,,,,8ac50daf-de21-4d05-b697-6d983b7ed3d5,"Tag2, Tag1",Quick reply1,"Trigger2, Trigger1",English,,[],/admin/images/usage/4/,,,ma_qa_temp,, +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,example_values,footer,language_code +Menu 1,0,5,appointment-reminders,,Appointment reminders,,,,,,,,,,,,,,,,,,8cff04aa-cf08-4120-88b4-e2269b7d5d80,,,,,,,,,,,,en +Menu 2,0,6,stage-based-messages,,Stage-based messages,,,,,,,,,,,,,,,,,,5f2d9e63-f047-41ab-921a-c5ca7c04d643,,,,,,,,,,,,en +Menu 3,0,7,health-info-messages,,Health info messages,,,,,,,,,,,,,,,,,,3db069a4-7112-4e66-a9a2-f35c6c18055a,,,,,,,,,,,,en +Menu 4,0,17,whatsapp-template-testing,,whatsapp template testing,,,,,,,,,,,,,,,,,,5f7221f4-146a-48c2-b2e3-c8491aaead9d,,,,,,,,,,,,en +Menu 5,0,164,import-export,,Import Export,,,,,,,,,,,,,,,,,,497bdc1f-43fc-4925-80a1-e68cb942faa4,,,,,,,,,,,,en +Sub 5.1,1,165,cp-import-export,Import Export,CP-Import/export,,,WA import export data,Message 1 contains an image,,,,,[],,,,,,,,,8ac50daf-de21-4d05-b697-6d983b7ed3d5,"Tag2, Tag1",Quick reply1,"Trigger2, Trigger1",,[],/admin/images/usage/4/,,,ma_qa_temp,,,en ,1,165,cp-import-export,,,,,,,,gender: male,Variation message one for Gender Male,,,,,,,,,,,,,,,,,,,,,,, -,2,165,cp-import-export,,,,,,"Message2 has a document attached",,,,,[],,,,,,,,,,,,,,,[],,/admin/documents/usage/1/,,,, +,2,165,cp-import-export,,,,,,Message2 has a document attached,,,,,[],,,,,,,,,,,,,,[],,/admin/documents/usage/1/,,,,, ,2,165,cp-import-export,,,,,,,,gender: empty,Variation message one for Gender Rather not say,,,,,,,,,,,,,,,,,,,,,,, -,3,165,cp-import-export,,,,,,Message 3 with no variation but has an audio clip,,,,,[],,,,,,,,,,,,,,,[],,,/admin/media/usage/1/,,, -Sub 5.2,1,166,ma_qa_temp,Import Export,MA QA Temp,,,,,,,,,,,,,,,,,,e9793b5f-f8c7-46c5-8a5e-bd9b8f00fee9,,,,English,,,,,,,, +,3,165,cp-import-export,,,,,,Message 3 with no variation but has an audio clip,,,,,[],,,,,,,,,,,,,,[],,,/admin/media/usage/1/,,,, +Sub 5.2,1,166,ma_qa_temp,Import Export,MA QA Temp,,,,,,,,,,,,,,,,,,e9793b5f-f8c7-46c5-8a5e-bd9b8f00fee9,,,,,,,,,,,,en diff --git a/home/tests/import-export-data/language_code_import.csv b/home/tests/import-export-data/language_code_import.csv new file mode 100644 index 00000000..11ee354e --- /dev/null +++ b/home/tests/import-export-data/language_code_import.csv @@ -0,0 +1,15 @@ +structure,message,page_id,Slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,4,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,,a0b85075-d01b-46bf-8997-8591e87ba171,,,,English,,,,,,,, +Sub 1.1,1,5,main-menu-first-time-user,Main Menu,main menu first time user,,,main menu first time user,"*Welcome to HealthAlert* 🌍 + +This is a messaging service created by the _*World Health Organization*_ *(WHO)* that provides information on COVID-19 as well as emergency resources for disease outbreaks, natural, and man-made disasters. + +_You can return to this main menu at any time by replying *0*_ 🏠 + +Choose what you'd like to know more about by tapping a button below ⬇️",,UTILITY,[],,,,[],,,,,main menu first time user,"Welcome to HealthAlert 🌍 + +This is a messaging service created by the World Health Organization (WHO) that provides information on COVID-19 as well as emergency resources for disease outbreaks, natural, and man-made disasters. + +You can return to this main menu at any time by replying 🏠 + +Choose what you'd like to know more about by tapping a button below ⬇️",,,5892bccd-8025-419d-9a8e-a6a37b755dbf,menu,"Self-help🌬️, Settings⚙️, Health Info🏥",Main menu🏠,English,,[],,,,,, diff --git a/home/tests/import-export-data/language_code_import_output.csv b/home/tests/import-export-data/language_code_import_output.csv new file mode 100644 index 00000000..1cb32630 --- /dev/null +++ b/home/tests/import-export-data/language_code_import_output.csv @@ -0,0 +1,15 @@ +structure,message,page_id,Slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,4,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,,a0b85075-d01b-46bf-8997-8591e87ba171,,,,,,,,,,,en +Sub 1.1,1,5,main-menu-first-time-user,Main Menu,main menu first time user,,,main menu first time user,"*Welcome to HealthAlert* 🌍 + +This is a messaging service created by the _*World Health Organization*_ *(WHO)* that provides information on COVID-19 as well as emergency resources for disease outbreaks, natural, and man-made disasters. + +_You can return to this main menu at any time by replying *0*_ 🏠 + +Choose what you'd like to know more about by tapping a button below ⬇️",,UTILITY,[],,,,[],,,,,main menu first time user,"Welcome to HealthAlert 🌍 + +This is a messaging service created by the World Health Organization (WHO) that provides information on COVID-19 as well as emergency resources for disease outbreaks, natural, and man-made disasters. + +You can return to this main menu at any time by replying 🏠 + +Choose what you'd like to know more about by tapping a button below ⬇️",,,5892bccd-8025-419d-9a8e-a6a37b755dbf,menu,"Self-help🌬️, Settings⚙️, Health Info🏥",Main menu🏠,,[],,,,,,en diff --git a/home/tests/import-export-data/list_items.csv b/home/tests/import-export-data/list_items.csv index 2ff3c17a..1b7d5690 100644 --- a/home/tests/import-export-data/list_items.csv +++ b/home/tests/import-export-data/list_items.csv @@ -1,3 +1,3 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,600,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,35a7f12c-7373-42a6-9ca6-a1caedea5822,,,,English,,,,,,, -Sub 1.1,1,601,ha-menu,Main Menu,HealthAlert menu,,,HealthAlert menu,*Welcome to HealthAlert* WA,,UTILITY,,,List Title,"'Item 1','Item 2'",,,,,HealthAlert menu,Welcome to HealthAlert M,HealthAlert menu,Welcome to HealthAlert V,5ab08854-228b-4f83-ae54-ec2dc6ebaf69,,,,English,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,600,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,35a7f12c-7373-42a6-9ca6-a1caedea5822,,,,,,,,,,,en +Sub 1.1,1,601,ha-menu,Main Menu,HealthAlert menu,,,HealthAlert menu,*Welcome to HealthAlert* WA,,UTILITY,,,List Title,"'Item 1','Item 2'",,,,,HealthAlert menu,Welcome to HealthAlert M,HealthAlert menu,Welcome to HealthAlert V,5ab08854-228b-4f83-ae54-ec2dc6ebaf69,,,,,[],,,,,,en diff --git a/home/tests/import-export-data/list_items_output.csv b/home/tests/import-export-data/list_items_output.csv index 94442790..b8348751 100644 --- a/home/tests/import-export-data/list_items_output.csv +++ b/home/tests/import-export-data/list_items_output.csv @@ -1,3 +1,3 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,600,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,35a7f12c-7373-42a6-9ca6-a1caedea5822,,,,English,,,,,,, -Sub 1.1,1,601,ha-menu,Main Menu,HealthAlert menu,,,HealthAlert menu,*Welcome to HealthAlert* WA,,UTILITY,,,List Title,"[{""type"": ""next_message"", ""title"": ""'Item 1'""}, {""type"": ""next_message"", ""title"": ""'Item 2'""}]",,,,,HealthAlert menu,Welcome to HealthAlert M,HealthAlert menu,Welcome to HealthAlert V,5ab08854-228b-4f83-ae54-ec2dc6ebaf69,,,,English,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,600,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,35a7f12c-7373-42a6-9ca6-a1caedea5822,,,,,,,,,,,en +Sub 1.1,1,601,ha-menu,Main Menu,HealthAlert menu,,,HealthAlert menu,*Welcome to HealthAlert* WA,,UTILITY,,,List Title,"[{""type"": ""next_message"", ""title"": ""'Item 1'""}, {""type"": ""next_message"", ""title"": ""'Item 2'""}]",,,,,HealthAlert menu,Welcome to HealthAlert M,HealthAlert menu,Welcome to HealthAlert V,5ab08854-228b-4f83-ae54-ec2dc6ebaf69,,,,,[],,,,,,en diff --git a/home/tests/import-export-data/list_items_with_comma.csv b/home/tests/import-export-data/list_items_with_comma.csv index 60eb74bd..9fafc565 100644 --- a/home/tests/import-export-data/list_items_with_comma.csv +++ b/home/tests/import-export-data/list_items_with_comma.csv @@ -1,7 +1,7 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,12,index,,Index,,,,,,,,,,,,,,,,,,,,573ff6a0-ed9c-4fe9-8285-7990ee12675f,,,,English,,,,,,, -Sub 1.1,1,5,test-2,Index,Test 2,,,Test 2,message test,,UTILITY,,,,List Title,,,,,,,,,,e03ea6c1-726c-4847-8fa0-90b36bdb9887,,,,English,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,, -Sub 1.2,1,4,test-1,Index,Test 1,,,Test messages,texting 123,,UTILITY,"EV 2, EV 1",,,List Title,"[{""type"": ""go_to_page"", ""title"": ""item 1"", ""slug"": ""test-2""}, {""type"": ""next_message"", ""title"": ""item 2""}]",,,,,,,,,17f43f94-a78e-4a63-86db-a32f2d70248c,,,,English,NP 1,"[{""type"": ""next_message"", ""title"": ""Btn 2""}, {""type"": ""next_message"", ""title"": ""Btn 1""}]",,,,, -Sub 1.2.1,1,6,list-item-test,Test 1,List item test,,,List item test,message test,,UTILITY,,,,List Title,"Item 3,Item 4,Item 2,Item 1",,,,,,,,,f351c9f0-751c-466e-acb6-09d607410491,,,,English,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,, -Sub 1.2.1.1,1,10,importexport,List item test,import/export Test,,,import/export test,import/export test,,UTILITY,,,,List Title,"""item 2, with comma"",item 3,item 1,Item' comma",,,,,,,,,cd9f38ec-6cd9-4289-873a-417d996493b4,,,,English,,[],,,,, -Sub 1.2.1.2,1,11,test-import,List item test,Test import,,,Test import,Test import,,UTILITY,,,,List Title,"item1,item2",,,,,,,,,6387db5b-ed76-4d34-86f4-92fbd9e1ebda,,,,English,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,12,index,,Index,,,,,,,,,,,,,,,,,,,,573ff6a0-ed9c-4fe9-8285-7990ee12675f,,,,English,,,,,,,,en +Sub 1.1,1,5,test-2,Index,Test 2,,,Test 2,message test,,UTILITY,,,,List Title,,,,,,,,,,e03ea6c1-726c-4847-8fa0-90b36bdb9887,,,,English,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,,,en +Sub 1.2,1,4,test-1,Index,Test 1,,,Test messages,texting 123,,UTILITY,"EV 2, EV 1",,,List Title,"[{""type"": ""go_to_page"", ""title"": ""item 1"", ""slug"": ""test-2""}, {""type"": ""next_message"", ""title"": ""item 2""}]",,,,,,,,,17f43f94-a78e-4a63-86db-a32f2d70248c,,,,English,NP 1,"[{""type"": ""next_message"", ""title"": ""Btn 2""}, {""type"": ""next_message"", ""title"": ""Btn 1""}]",,,,,, +Sub 1.2.1,1,6,list-item-test,Test 1,List item test,,,List item test,message test,,UTILITY,,,,List Title,"Item 3,Item 4,Item 2,Item 1",,,,,,,,,f351c9f0-751c-466e-acb6-09d607410491,,,,English,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,,, +Sub 1.2.1.1,1,10,importexport,List item test,import/export Test,,,import/export test,import/export test,,UTILITY,,,,List Title,"""item 2, with comma"",item 3,item 1,Item' comma",,,,,,,,,cd9f38ec-6cd9-4289-873a-417d996493b4,,,,English,,[],,,,,, +Sub 1.2.1.2,1,11,test-import,List item test,Test import,,,Test import,Test import,,UTILITY,,,,List Title,"item1,item2",,,,,,,,,6387db5b-ed76-4d34-86f4-92fbd9e1ebda,,,,English,,[],,,,,, diff --git a/home/tests/import-export-data/list_items_with_comma_output.csv b/home/tests/import-export-data/list_items_with_comma_output.csv index 192c3d98..16c1888a 100644 --- a/home/tests/import-export-data/list_items_with_comma_output.csv +++ b/home/tests/import-export-data/list_items_with_comma_output.csv @@ -1,7 +1,7 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,12,index,,Index,,,,,,,,,,,,,,,,,,,,573ff6a0-ed9c-4fe9-8285-7990ee12675f,,,,English,,,,,,, -Sub 1.1,1,5,test-2,Index,Test 2,,,Test 2,message test,,UTILITY,,,,List Title,[],,,,,,,,,e03ea6c1-726c-4847-8fa0-90b36bdb9887,,,,English,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,, -Sub 1.2,1,4,test-1,Index,Test 1,,,Test messages,texting 123,,UTILITY,"EV 2, EV 1",,,List Title,"[{""type"": ""go_to_page"", ""title"": ""item 1"", ""slug"": ""test-2""}, {""type"": ""next_message"", ""title"": ""item 2""}]",,,,,,,,,17f43f94-a78e-4a63-86db-a32f2d70248c,,,,English,NP 1,"[{""type"": ""next_message"", ""title"": ""Btn 2""}, {""type"": ""next_message"", ""title"": ""Btn 1""}]",,,,, -Sub 1.2.1,1,6,list-item-test,Test 1,List item test,,,List item test,message test,,UTILITY,,,,List Title,"[{""type"": ""next_message"", ""title"": ""Item 3""}, {""type"": ""next_message"", ""title"": ""Item 4""}, {""type"": ""next_message"", ""title"": ""Item 2""}, {""type"": ""next_message"", ""title"": ""Item 1""}]",,,,,,,,,f351c9f0-751c-466e-acb6-09d607410491,,,,English,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,, -Sub 1.2.1.1,1,10,importexport,List item test,import/export Test,,,import/export test,import/export test,,UTILITY,,,,List Title,"[{""type"": ""next_message"", ""title"": ""item 2, with comma""}, {""type"": ""next_message"", ""title"": ""item 3""}, {""type"": ""next_message"", ""title"": ""item 1""}, {""type"": ""next_message"", ""title"": ""Item' comma""}]",,,,,,,,,cd9f38ec-6cd9-4289-873a-417d996493b4,,,,English,,[],,,,, -Sub 1.2.1.2,1,11,test-import,List item test,Test import,,,Test import,Test import,,UTILITY,,,,List Title,"[{""type"": ""next_message"", ""title"": ""item1""}, {""type"": ""next_message"", ""title"": ""item2""}]",,,,,,,,,6387db5b-ed76-4d34-86f4-92fbd9e1ebda,,,,English,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,12,index,,Index,,,,,,,,,,,,,,,,,,,,573ff6a0-ed9c-4fe9-8285-7990ee12675f,,,,,,,,,,,en +Sub 1.1,1,5,test-2,Index,Test 2,,,Test 2,message test,,UTILITY,,,,List Title,[],,,,,,,,,e03ea6c1-726c-4847-8fa0-90b36bdb9887,,,,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,,,en +Sub 1.2,1,4,test-1,Index,Test 1,,,Test messages,texting 123,,UTILITY,"EV 2, EV 1",,,List Title,"[{""type"": ""go_to_page"", ""title"": ""item 1"", ""slug"": ""test-2""}, {""type"": ""next_message"", ""title"": ""item 2""}]",,,,,,,,,17f43f94-a78e-4a63-86db-a32f2d70248c,,,,NP 1,"[{""type"": ""next_message"", ""title"": ""Btn 2""}, {""type"": ""next_message"", ""title"": ""Btn 1""}]",,,,,,en +Sub 1.2.1,1,6,list-item-test,Test 1,List item test,,,List item test,message test,,UTILITY,,,,List Title,"[{""type"": ""next_message"", ""title"": ""Item 3""}, {""type"": ""next_message"", ""title"": ""Item 4""}, {""type"": ""next_message"", ""title"": ""Item 2""}, {""type"": ""next_message"", ""title"": ""Item 1""}]",,,,,,,,,f351c9f0-751c-466e-acb6-09d607410491,,,,,"[{""type"": ""next_message"", ""title"": ""Btn 1""}, {""type"": ""next_message"", ""title"": ""Btn 2""}]",,,,,,en +Sub 1.2.1.1,1,10,importexport,List item test,import/export Test,,,import/export test,import/export test,,UTILITY,,,,List Title,"[{""type"": ""next_message"", ""title"": ""item 2, with comma""}, {""type"": ""next_message"", ""title"": ""item 3""}, {""type"": ""next_message"", ""title"": ""item 1""}, {""type"": ""next_message"", ""title"": ""Item' comma""}]",,,,,,,,,cd9f38ec-6cd9-4289-873a-417d996493b4,,,,,[],,,,,,en +Sub 1.2.1.2,1,11,test-import,List item test,Test import,,,Test import,Test import,,UTILITY,,,,List Title,"[{""type"": ""next_message"", ""title"": ""item1""}, {""type"": ""next_message"", ""title"": ""item2""}]",,,,,,,,,6387db5b-ed76-4d34-86f4-92fbd9e1ebda,,,,,[],,,,,,en diff --git a/home/tests/import-export-data/multiple_messages.csv b/home/tests/import-export-data/multiple_messages.csv index 4a85fdd1..635001ac 100644 --- a/home/tests/import-export-data/multiple_messages.csv +++ b/home/tests/import-export-data/multiple_messages.csv @@ -1,8 +1,8 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,600,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,35a7f12c-7373-42a6-9ca6-a1caedea5822,,,,English,,,,,,, -Sub 1.1,1,601,ha-menu,Main Menu,HealthAlert menu,,,HealthAlert menu,*Welcome to HealthAlert* WA,,UTILITY,,,,[],,,,,HealthAlert menu,Welcome to HealthAlert M,HealthAlert menu,Welcome to HealthAlert V,5ab08854-228b-4f83-ae54-ec2dc6ebaf69,,,,English,,[],,,,, -Sub 1.1.1,1,602,health-info,HealthAlert menu,health info,,,health info,wa1,,UTILITY,,,,[],,,,,health info,m1,health info,v1,117e862d-57dd-4be6-a802-cdc075a725b2,,,,English,,[],,,,, -,2,602,health-info,,,,,,wa2,,,,,,[],,,,,,m2,,v2,,,,,,,[],,,,, -,3,602,health-info,,,,,,wa3,,,,,,[],,,,,,m3,,v3,,,,,,,[],,,,, -,4,602,health-info,,,,,,wa4,,,,,,[],,,,,,m4,,,,,,,,,[],,,,, -,5,602,health-info,,,,,,wa5,,,,,,[],,,,,,,,,,,,,,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,600,main-menu,,Main Menu,,,,,,,,,,,,,,,,,,,35a7f12c-7373-42a6-9ca6-a1caedea5822,,,,,,,,,,,en +Sub 1.1,1,601,ha-menu,Main Menu,HealthAlert menu,,,HealthAlert menu,*Welcome to HealthAlert* WA,,UTILITY,,,,[],,,,,HealthAlert menu,Welcome to HealthAlert M,HealthAlert menu,Welcome to HealthAlert V,5ab08854-228b-4f83-ae54-ec2dc6ebaf69,,,,,[],,,,,,en +Sub 1.1.1,1,602,health-info,HealthAlert menu,health info,,,health info,wa1,,UTILITY,,,,[],,,,,health info,m1,health info,v1,117e862d-57dd-4be6-a802-cdc075a725b2,,,,,[],,,,,,en +,2,602,health-info,,,,,,wa2,,,,,,[],,,,,,m2,,v2,,,,,,[],,,,,, +,3,602,health-info,,,,,,wa3,,,,,,[],,,,,,m3,,v3,,,,,,[],,,,,, +,4,602,health-info,,,,,,wa4,,,,,,[],,,,,,m4,,,,,,,,[],,,,,, +,5,602,health-info,,,,,,wa5,,,,,,[],,,,,,,,,,,,,,[],,,,,, diff --git a/home/tests/import-export-data/no-translation-key-default.csv b/home/tests/import-export-data/no-translation-key-default.csv index 337e6e0e..220b61f8 100644 --- a/home/tests/import-export-data/no-translation-key-default.csv +++ b/home/tests/import-export-data/no-translation-key-default.csv @@ -1,3 +1,3 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,659,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,,,,,English,,,,,,, -Sub 1.1,1,660,locale-import,MA_import export,Locale import,,,import per locale,this is the english message..edit,,UTILITY,,,,,[],,,,,,,,,,,,,English,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,659,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,en +Sub 1.1,1,660,locale-import,MA_import export,Locale import,,,import per locale,this is the english message..edit,,UTILITY,,,,,[],,,,,,,,,,,,,,[],,,,,,en diff --git a/home/tests/import-export-data/translations-en.csv b/home/tests/import-export-data/translations-en.csv index 959f9210..ddbcfec9 100644 --- a/home/tests/import-export-data/translations-en.csv +++ b/home/tests/import-export-data/translations-en.csv @@ -1,3 +1,3 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,659,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,English,,,,,,, -Sub 1.1,1,660,locale-import,MA_import export,Locale import,,,import per locale,this is the english message..edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,English,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,659,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,,,,,,,,en +Sub 1.1,1,660,locale-import,MA_import export,Locale import,,,import per locale,this is the english message..edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,,[],,,,,,en diff --git a/home/tests/import-export-data/translations-pt.csv b/home/tests/import-export-data/translations-pt.csv index e4549c03..fbd968b6 100644 --- a/home/tests/import-export-data/translations-pt.csv +++ b/home/tests/import-export-data/translations-pt.csv @@ -1,3 +1,3 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,1297,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,Portuguese,,,,,,, -Sub 1.1,1,1298,locale-import,MA_import export,Locale import,,,import per locale,this is the Portuguese message....edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,Portuguese,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,1297,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,,,,,,,,pt +Sub 1.1,1,1298,locale-import,MA_import export,Locale import,,,import per locale,this is the Portuguese message....edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,,[],,,,,,pt diff --git a/home/tests/import-export-data/translations.csv b/home/tests/import-export-data/translations.csv index e6f846fa..533adad6 100644 --- a/home/tests/import-export-data/translations.csv +++ b/home/tests/import-export-data/translations.csv @@ -1,5 +1,5 @@ -structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,locale,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer -Menu 1,0,659,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,English,,,,,,, -Sub 1.1,1,660,locale-import,MA_import export,Locale import,,,import per locale,this is the english message..edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,English,,[],,,,, -Menu 1,0,1297,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,Portuguese,,,,,,, -Sub 1.1,1,1298,locale-import,MA_import export,Locale import,,,import per locale,this is the Portuguese message....edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,Portuguese,,[],,,,, \ No newline at end of file +structure,message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,whatsapp_template_name,whatsapp_template_category,example_values,variation_title,variation_body,list_title,list_items,sms_title,sms_body,ussd_title,ussd_body,messenger_title,messenger_body,viber_title,viber_body,translation_tag,tags,quick_replies,triggers,next_prompt,buttons,image_link,doc_link,media_link,related_pages,footer,language_code +Menu 1,0,659,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,,,,,,,,en +Sub 1.1,1,660,locale-import,MA_import export,Locale import,,,import per locale,this is the english message..edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,,[],,,,,,en +Menu 1,0,1297,ma_import-export,,MA_import export,,,,,,,,,,,,,,,,,,,,38a22433-e474-4f5a-b06b-7367d1a7f664,,,,,,,,,,,pt +Sub 1.1,1,1298,locale-import,MA_import export,Locale import,,,import per locale,this is the Portuguese message....edit,,UTILITY,,,,,[],,,,,,,,,9aab62ab-caf7-4606-b9bf-ac3148309319,,,,,[],,,,,,pt diff --git a/home/tests/import-export-data/whitespace-only-fields.csv b/home/tests/import-export-data/whitespace-only-fields.csv index e7fa3d2c..820001d8 100644 --- a/home/tests/import-export-data/whitespace-only-fields.csv +++ b/home/tests/import-export-data/whitespace-only-fields.csv @@ -1,3 +1,3 @@ -Structure,Message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,variation_body,variation_title,next_prompt,messenger_title,messenger_body,viber_title,viber_body,tags,quick_replies,triggers,locale,image_link,doc_link,media_link,footer,related_pages,footer -Menu 1,0, ,main-menu,,test,,,,,,,,,,,,,,,English,,,, -Sub 1.1.1,1,,content-page,,Web Title 1,Web subtitle 1,web body,Whatsapp Title 1,"First whatsapp message",,,,,,,,"tag1,tag2",,,English,,,, , +Structure,Message,page_id,slug,parent,web_title,web_subtitle,web_body,whatsapp_title,whatsapp_body,variation_body,variation_title,next_prompt,messenger_title,messenger_body,viber_title,viber_body,tags,quick_replies,triggers,locale,image_link,doc_link,media_link,footer,related_pages,footer,language_code +Menu 1,0, ,main-menu,,test,,,,,,,,,,,,,,,English,,,,,,,en +Sub 1.1.1,1,,content-page,,Web Title 1,Web subtitle 1,web body,Whatsapp Title 1,First whatsapp message,,,,,,,,"tag1,tag2",,,English,,,, ,,,en diff --git a/home/tests/test_content_import_export.py b/home/tests/test_content_import_export.py index 239a46c8..5c8f429c 100644 --- a/home/tests/test_content_import_export.py +++ b/home/tests/test_content_import_export.py @@ -413,7 +413,7 @@ def _filter_export_row(self, row: ExpDict, locale: str | None) -> bool: Determine whether to keep a given export row. """ if locale: - if row["locale"] not in [None, "", locale]: + if row.get("locale") not in [None, "", locale]: return False return True @@ -467,6 +467,7 @@ def export_content(self, locale: str | None = None) -> bytes: print("-v-CONTENT-v-") print(content.decode()) print("-^-CONTENT-^-") + return content def export_ordered_content(self) -> bytes: @@ -798,6 +799,7 @@ def test_no_translation_key_default(self, csv_impexp: ImportExport) -> None: for row in dst: assert len(row["translation_tag"]) == 36 # uuid with dashes row["translation_tag"] = "" + assert dst == src def test_no_translation_key_nondefault(self, csv_impexp: ImportExport) -> None: @@ -1650,6 +1652,18 @@ def test_invalid_page_already_in_db(self, csv_impexp: ImportExport) -> None: "Validation error: example_values - The number of example values provided (1) does not match the number of variables used in the template (3)" ] + def test_language_code_import(self, csv_impexp: ImportExport) -> None: + """ """ + csv_impexp.import_file("language_code_import.csv") + content = csv_impexp.export_content() + + new_export_content = csv_impexp.read_bytes( + "language_code_import_output.csv", IMP_EXP_DATA_BASE + ) + + src, dst = csv_impexp.csvs2dicts(new_export_content, content) + assert dst == src + @pytest.mark.django_db class TestExport: @@ -2424,7 +2438,6 @@ def test_translations_en(self, impexp: ImportExport) -> None: orig_en = impexp.get_page_json(locale="en") content = impexp.export_content() - impexp.import_content(content, locale="en") imported = impexp.get_page_json() assert imported == orig_en