diff --git a/backend/doc/config.py b/backend/doc/config.py index 10294c59..58611f6d 100755 --- a/backend/doc/config.py +++ b/backend/doc/config.py @@ -129,11 +129,13 @@ class Settings(BaseSettings): USFM_RESOURCE_TYPES: Sequence[str] = [ "avd", "ayt", + "bpb", "blv", "cuv", "f10", "nav", "reg", + "tbi", # "udb", # Content team doesn't want udb used for any language, e.g., en, mr, tl, gu "ugnt", "uhb", @@ -145,14 +147,16 @@ class Settings(BaseSettings): # there are any) that we want to be available to users. These are all # that I found of relevance in the data API. RESOURCE_TYPE_CODES_AND_NAMES: Mapping[str, str] = { - "ayt": "Bahasa Indonesian Bible", + "ayt": "Alkitab Yang Terbuka (Easy-to-Read Indonesian Bible)", "bc": "Bible Commentary", "blv": "Portuguese Bíblia Livre", + "bpb": "Bulgarian Protestant Bible", "cuv": "新标点和合本", "f10": "French Louis Segond 1910 Bible", "nav": "New Arabic Version (Ketab El Hayat)", "reg": "Regular", "rg": "NT Survey Reviewers' Guide", + "tbi": "Terjemahan Baru (Indonesian New Translation Bible)", "tn": "Translation Notes", "tn-condensed": "Condensed Translation Notes", "tq": "Translation Questions", diff --git a/backend/doc/domain/assembly_strategies/assemble_by_book.py b/backend/doc/domain/assembly_strategies/assemble_by_book.py index 824670ce..cece4f1c 100755 --- a/backend/doc/domain/assembly_strategies/assemble_by_book.py +++ b/backend/doc/domain/assembly_strategies/assemble_by_book.py @@ -10,6 +10,7 @@ get_usfm_and_tw, get_usfm_and_tw_verse, get_non_usfm_resources_verse, + order_usfm_resources, rg_chapter_verses, ) from doc.domain.bible_books import BOOK_ID_MAP, BOOK_NAMES @@ -47,9 +48,6 @@ def assemble_content_by_book( show_tn_chapter_intro: bool, book_names: Mapping[str, str] = BOOK_NAMES, book_id_map: dict[str, int] = BOOK_ID_MAP, - resource_type_codes_and_names: Mapping[ - str, str - ] = settings.RESOURCE_TYPE_CODES_AND_NAMES, ) -> list[DocumentPart]: document_parts: list[DocumentPart] = [] lang_codes = collect_unique_lang_codes( @@ -69,23 +67,8 @@ def assemble_content_by_book( usfm_book2 = None if len(selected_usfm_books) == 1: usfm_book = selected_usfm_books[0] - elif ( - len(selected_usfm_books) == 2 - ): # Second USFM chosen, e.g., fr f10, tl udb, pt-br blv. - # Assuming f10 should be treated as secondary to ulb for fr and blv as a - # secondary to ulb for pt-br. - # TODO Later we might do resources types by clicked order at which point we would likely - # just use the body of the else clause below. - if selected_usfm_books[0].resource_type_name in [ - resource_type_codes_and_names.get("f10", ""), - resource_type_codes_and_names.get("udb", ""), - resource_type_codes_and_names.get("blv", ""), - ]: - usfm_book = selected_usfm_books[1] - usfm_book2 = selected_usfm_books[0] - else: - usfm_book = selected_usfm_books[0] - usfm_book2 = selected_usfm_books[1] + elif len(selected_usfm_books) == 2: + usfm_book, usfm_book2 = order_usfm_resources(selected_usfm_books) tn_book = next( ( tn_book @@ -227,9 +210,6 @@ def assemble_content_by_verse_book_at_a_time( show_rg_chapter_commentary: bool, book_names: Mapping[str, str] = BOOK_NAMES, book_id_map: dict[str, int] = BOOK_ID_MAP, - resource_type_codes_and_names: Mapping[ - str, str - ] = settings.RESOURCE_TYPE_CODES_AND_NAMES, ) -> list[DocumentPart]: document_parts: list[DocumentPart] = [] lang_codes = collect_unique_lang_codes( @@ -249,20 +229,8 @@ def assemble_content_by_verse_book_at_a_time( usfm_book2 = None if len(selected_usfm_books) == 1: usfm_book = selected_usfm_books[0] - elif len(selected_usfm_books) == 2: # Second USFM chosen, e.g., fr f10 - # TODO Later we might do resources types by clicked order at which point we would likely - # just use the else clause below. - # Assuming f10 should be treated as secondary to ulb for fr - if selected_usfm_books[0].resource_type_name in [ - resource_type_codes_and_names.get("f10", ""), - resource_type_codes_and_names.get("udb", ""), - resource_type_codes_and_names.get("blv", ""), - ]: - usfm_book = selected_usfm_books[1] - usfm_book2 = selected_usfm_books[0] - else: - usfm_book = selected_usfm_books[0] - usfm_book2 = selected_usfm_books[1] + elif len(selected_usfm_books) == 2: + usfm_book, usfm_book2 = order_usfm_resources(selected_usfm_books) tn_book = next( ( tn_book diff --git a/backend/doc/domain/assembly_strategies/assemble_by_chapter.py b/backend/doc/domain/assembly_strategies/assemble_by_chapter.py index 29ff87d1..7ed99b36 100644 --- a/backend/doc/domain/assembly_strategies/assemble_by_chapter.py +++ b/backend/doc/domain/assembly_strategies/assemble_by_chapter.py @@ -16,6 +16,7 @@ get_non_usfm_resources_chapter, get_usfm_and_tw, get_usfm_and_tw_verse, + order_usfm_resources, rg_chapter_verses, tn_chapter_intro, tnc_chapter_intro, @@ -276,9 +277,6 @@ def assemble_usfm_by_chapter( show_tn_chapter_intro: bool, book_chapters: Mapping[str, int] = BOOK_CHAPTERS, fmt_str: str = settings.BOOK_NAME_FMT_STR, - resource_type_codes_and_names: Mapping[ - str, str - ] = settings.RESOURCE_TYPE_CODES_AND_NAMES, ) -> list[DocumentPart]: is_rtl = usfm_books[0].lang_direction == LangDirEnum.RTL if usfm_books else False document_parts: list[DocumentPart] = [] @@ -312,20 +310,8 @@ def assemble_usfm_by_chapter( usfm_book2 = None if len(selected_usfm_books) == 1: usfm_book = selected_usfm_books[0] - elif len(selected_usfm_books) == 2: # Second USFM chosen, e.g., fr f10 - # Assuming f10 should be treated as secondary to ulb for fr - # TODO Later we might do resources types by clicked order at which point we would likely - # just use the else clause below. - if selected_usfm_books[0].resource_type_name in [ - resource_type_codes_and_names.get("f10", ""), - resource_type_codes_and_names.get("udb", ""), - resource_type_codes_and_names.get("blv", ""), - ]: - usfm_book = selected_usfm_books[1] - usfm_book2 = selected_usfm_books[0] - else: - usfm_book = selected_usfm_books[0] - usfm_book2 = selected_usfm_books[1] + elif len(selected_usfm_books) == 2: + usfm_book, usfm_book2 = order_usfm_resources(selected_usfm_books) if usfm_book: document_parts.append( DocumentPart( @@ -437,9 +423,6 @@ def assemble_usfm_by_verse_chapter_at_a_time( show_rg_chapter_commentary: bool, book_chapters: Mapping[str, int] = BOOK_CHAPTERS, fmt_str: str = settings.RESOURCE_TYPE_NAME_FMT_STR, - resource_type_codes_and_names: Mapping[ - str, str - ] = settings.RESOURCE_TYPE_CODES_AND_NAMES, ) -> list[DocumentPart]: is_rtl = usfm_books[0].lang_direction == LangDirEnum.RTL if usfm_books else False document_parts: list[DocumentPart] = [] @@ -521,16 +504,7 @@ def assemble_usfm_by_verse_chapter_at_a_time( if len(selected_usfm_books) == 1: usfm_book = selected_usfm_books[0] elif len(selected_usfm_books) == 2: - if selected_usfm_books[0].resource_type_name in [ - resource_type_codes_and_names.get("f10", ""), - resource_type_codes_and_names.get("udb", ""), - resource_type_codes_and_names.get("blv", ""), - ]: - usfm_book2 = selected_usfm_books[0] - usfm_book = selected_usfm_books[1] - else: - usfm_book = selected_usfm_books[0] - usfm_book2 = selected_usfm_books[1] + usfm_book, usfm_book2 = order_usfm_resources(selected_usfm_books) if usfm_book and chapter_num in usfm_book.chapters: usfm_chapter = usfm_book.chapters[chapter_num] if usfm_book2 and chapter_num in usfm_book2.chapters: diff --git a/backend/doc/domain/assembly_strategies/assembly_strategy_utils.py b/backend/doc/domain/assembly_strategies/assembly_strategy_utils.py index 9178f618..e178c0d2 100644 --- a/backend/doc/domain/assembly_strategies/assembly_strategy_utils.py +++ b/backend/doc/domain/assembly_strategies/assembly_strategy_utils.py @@ -3,7 +3,7 @@ """ from re import search -from typing import Optional, Sequence +from typing import Mapping, Optional, Sequence from doc.config import settings from doc.domain.bible_books import BOOK_ID_MAP @@ -1197,6 +1197,42 @@ def filter_books_by_lang_code( ) +def order_usfm_resources( + usfm_books: Sequence[USFMBook], + resource_type_codes_and_names: Mapping[ + str, str + ] = settings.RESOURCE_TYPE_CODES_AND_NAMES, +) -> tuple[USFMBook, USFMBook]: + usfm_book0 = usfm_books[0] + if ( + usfm_book0.lang_code == "fr" + and usfm_book0.resource_type_name + in [ + resource_type_codes_and_names.get("ulb", ""), + ] + or usfm_book0.resource_type_name + in [ + resource_type_codes_and_names.get("udb", ""), + ] + or usfm_book0.lang_code == "id" + and usfm_book0.resource_type_name + in [ + resource_type_codes_and_names.get("ayt", ""), + ] + or usfm_book0.lang_code == "pt-br" + and usfm_book0.resource_type_name + in [ + resource_type_codes_and_names.get("blv", ""), + ] + ): + usfm_book = usfm_books[1] + usfm_book2 = usfm_books[0] + else: + usfm_book = usfm_books[0] + usfm_book2 = usfm_books[1] + return usfm_book, usfm_book2 + + if __name__ == "__main__": # To run the doctests in this module, in the root of the project do: diff --git a/backend/doc/domain/resource_lookup.py b/backend/doc/domain/resource_lookup.py index e0de8ec0..6215a978 100644 --- a/backend/doc/domain/resource_lookup.py +++ b/backend/doc/domain/resource_lookup.py @@ -54,6 +54,10 @@ maxsize=1, ttl=settings.DATA_API_CACHE_TTL_SECONDS ) +fetch_non_primary_source_data_cache: TTLCache[str, SourceData] = TTLCache( + maxsize=1, ttl=settings.DATA_API_CACHE_TTL_SECONDS +) + @cached(fetch_source_data_cache) def fetch_source_data( @@ -126,6 +130,79 @@ def fetch_source_data( return SourceData(git_repo=[]) +@cached(fetch_non_primary_source_data_cache) +def fetch_non_primary_source_data( + data_api_url: HttpUrl = settings.DATA_API_URL, + user_agent_str: str = settings.USER_AGENT_STR, + x_requested_with_value: str = settings.X_REQUESTED_WITH_VALUE, +) -> Optional[SourceData]: + """ + Downloads data from a GraphQL API. + + >>> from doc.domain import resource_lookup + >>> ();result = resource_lookup.fetch_source_data();() # doctest: +ELLIPSIS + (...) + >>> result.git_repo[0] + RepoEntry(repo_url=HttpUrl('https://content.bibletranslationtools.org/WA-Catalog/bg_bpb'), + content=Content(resource_type='bpb', language=Language(english_name='Bulgarian', ietf_code='bg', national_name='български език', direction=))) + """ + graphql_query = """ +query MyQuery { + git_repo( + where: {content: {language: {ietf_code: {_eq: "bg"}}}} + ) { + repo_url + content { + resource_type + language { + english_name + ietf_code + national_name + direction + } + } + } +} + """ + query_json = {"query": graphql_query} + headers = {"User-Agent": user_agent_str, "X-Requested-With": x_requested_with_value} + try: + response = requests.post(str(data_api_url), json=query_json, headers=headers) + if response.status_code == 200: + data_payload = response.json().get("data", {}) + if "git_repo" in data_payload: + valid_repos = [ + repo + for repo in data_payload["git_repo"] + if repo.get("content", {}).get("resource_type") is not None + and repo.get("content", {}).get("language") is not None + and "WA-Catalog" in repo.get("repo_url", {}) + ] + # Sort for test stability - ensures consistent ordering + valid_repos.sort(key=lambda repo: repo["repo_url"]) + return SourceData.model_validate({"git_repo": valid_repos}) + else: + logger.info("Invalid payload structure, no data.") + return SourceData(git_repo=[]) + else: + logger.info( + "Failed to get data from data API, graphql API might be down..." + ) + return SourceData(git_repo=[]) + except requests.RequestException as e: + logger.exception("Request failed: %s", e) + logger.info("Failed to get data from data API, API might be down...") + return SourceData(git_repo=[]) + except ValidationError as e: + logger.exception( + "Request failed due to invalid data returned from data API: %s", e + ) + logger.info( + "Some of the data returned by data API is invalid, check logs for details" + ) + return SourceData(git_repo=[]) + + def lang_codes_and_names( # lang_code_filter_list: Sequence[str] = settings.LANG_CODE_FILTER_LIST, gateway_languages: frozenset[str] = settings.GATEWAY_LANGUAGES, @@ -141,6 +218,7 @@ def lang_codes_and_names( 'aac' """ data = fetch_source_data() + non_primary_data = fetch_non_primary_source_data() values = [] if data is None or not data.git_repo: logger.info("Data API is down or no git_repo found!") @@ -162,6 +240,39 @@ def lang_codes_and_names( ) except Exception: logger.exception("Failed due to the following exception.") + if non_primary_data is None or not non_primary_data.git_repo: + logger.info("Data API is down or no git_repo found!") + return [] + try: + for non_primary_repo_info in non_primary_data.git_repo: + non_primary_language_info = non_primary_repo_info.content + non_primary_language = non_primary_language_info.language + non_primary_ietf_code = non_primary_language.ietf_code + non_primary_english_name = ( + non_primary_language.english_name + if non_primary_language.english_name + else "" + ) + non_primary_localized_name = non_primary_language.national_name + non_primary_is_gateway = non_primary_ietf_code in gateway_languages + if non_primary_english_name in non_primary_localized_name: + values.append( + ( + non_primary_ietf_code, + non_primary_localized_name, + non_primary_is_gateway, + ) + ) + else: + values.append( + ( + non_primary_ietf_code, + f"{non_primary_localized_name} ({non_primary_english_name})", + non_primary_is_gateway, + ) + ) + except Exception: + logger.exception("Failed due to the following exception.") unique_values = unique_tuples(values) return sorted(unique_values, key=lambda value: value[1]) @@ -622,6 +733,12 @@ def make_entry(url: HttpUrl, resource_type: str, lang: Language) -> RepoEntry: repo_url=url, content=Content(resource_type=resource_type, language=lang) ) + bg_lang = Language( + english_name="Bulgarian", + ietf_code="bg", + national_name="български език", + direction=LangDirEnum.LTR, + ) id_lang = Language( english_name="Indonesian", ietf_code="id", @@ -635,6 +752,23 @@ def make_entry(url: HttpUrl, resource_type: str, lang: Language) -> RepoEntry: direction=LangDirEnum.LTR, ) extra_entries = [ + make_entry( + HttpUrl("https://content.bibletranslationtools.org/WA-Catalog/bg_bpb"), + "bpb", + bg_lang, + ), + make_entry( + HttpUrl( + "https://content.bibletranslationtools.org/WycliffeAssociates/en_tn_condensed" + ), + "tn-condensed", + en_lang, + ), + make_entry( + HttpUrl("https://content.bibletranslationtools.org/WA-Catalog/id_tbi"), + "tbi", + id_lang, + ), make_entry( HttpUrl("https://content.bibletranslationtools.org/WA-Catalog/id_ayt"), "ayt", @@ -650,25 +784,6 @@ def make_entry(url: HttpUrl, resource_type: str, lang: Language) -> RepoEntry: "tw", id_lang, ), - make_entry( - HttpUrl( - "https://content.bibletranslationtools.org/WycliffeAssociates/en_tn_condensed" - ), - "tn-condensed", - en_lang, - ), - # make_entry( - # HttpUrl( - # # NOTE: this URL is actually not used in DOC because the file no longer exists - # # there. Instead we provide this file for ourselves and copy it into - # # place from the root of this project at FastAPI initialization. One day - # # it would be nice to have this live somewhere online so that - # # potentially updated versions could be acquired. - # "https://github.com/WycliffeAssociates/TS-biel-files/blob/master/training/en/Refinement%20and%20Publication/Reviewers'%20Guide/NT%20Survey%20RG%20Files/NT%20Survey%20Reviewers'%20Guide.docx" - # ), - # "rg", - # en_lang, - # ), ] existing_pairs = { (entry.content.language.ietf_code, entry.content.resource_type) diff --git a/backend/stet/data/stet_rmn-x-yerliroman.docx b/backend/stet/data/stet_bg.docx similarity index 100% rename from backend/stet/data/stet_rmn-x-yerliroman.docx rename to backend/stet/data/stet_bg.docx diff --git a/backend/stet/data/stet_ceb.docx b/backend/stet/data/stet_ceb.docx new file mode 100644 index 00000000..59846ab1 Binary files /dev/null and b/backend/stet/data/stet_ceb.docx differ diff --git a/backend/stet/data/stet_id.docx b/backend/stet/data/stet_id.docx new file mode 100644 index 00000000..f88a7ca8 Binary files /dev/null and b/backend/stet/data/stet_id.docx differ diff --git a/backend/stet/data/stet_tl.docx b/backend/stet/data/stet_tl.docx new file mode 100644 index 00000000..cc323d79 Binary files /dev/null and b/backend/stet/data/stet_tl.docx differ diff --git a/backend/stet/data/stet_vi.docx b/backend/stet/data/stet_vi.docx index aa0a89e2..ad057653 100644 Binary files a/backend/stet/data/stet_vi.docx and b/backend/stet/data/stet_vi.docx differ diff --git a/backend/stet/domain/resource_lookup.py b/backend/stet/domain/resource_lookup.py index d8db861e..fc7ba4aa 100644 --- a/backend/stet/domain/resource_lookup.py +++ b/backend/stet/domain/resource_lookup.py @@ -1,7 +1,7 @@ from typing import Sequence from doc.config import settings -from doc.domain.resource_lookup import fetch_source_data +from doc.domain.resource_lookup import fetch_source_data, fetch_non_primary_source_data from doc.utils.list_utils import unique_tuples # List of languages which do not have USFM available for NT books. We use this @@ -30,6 +30,7 @@ def lang_codes_and_names_having_usfm( 'aao' """ data = fetch_source_data() + non_primary_data = fetch_non_primary_source_data() values = [] if data is None or not data.git_repo: logger.info("Data API is down or no git_repo found!") @@ -51,5 +52,39 @@ def lang_codes_and_names_having_usfm( ) except Exception: logger.exception("Failed due to the following exception.") + if non_primary_data is None or not non_primary_data.git_repo: + logger.info("Data API is down or no git_repo found!") + return [] + try: + for non_primary_repo_info in non_primary_data.git_repo: + non_primary_language_info = non_primary_repo_info.content + non_primary_language = non_primary_language_info.language + non_primary_ietf_code = non_primary_language.ietf_code + non_primary_english_name = ( + non_primary_language.english_name + if non_primary_language.english_name + else "" + ) + non_primary_localized_name = non_primary_language.national_name + non_primary_is_gateway = non_primary_ietf_code in gateway_languages + if non_primary_ietf_code not in lang_code_filter_list: + if non_primary_english_name in non_primary_localized_name: + values.append( + ( + non_primary_ietf_code, + non_primary_localized_name, + non_primary_is_gateway, + ) + ) + else: + values.append( + ( + non_primary_ietf_code, + f"{non_primary_localized_name} ({non_primary_english_name})", + non_primary_is_gateway, + ) + ) + except Exception: + logger.exception("Failed due to the following exception.") unique_values = unique_tuples(values) return sorted(unique_values, key=lambda value: value[1]) diff --git a/backend/stet/domain/strings.py b/backend/stet/domain/strings.py index ec2902fc..569fbdf5 100644 --- a/backend/stet/domain/strings.py +++ b/backend/stet/domain/strings.py @@ -1,61 +1,73 @@ TRANSLATED_HEADER_PHRASES_TABLE: dict[str, str] = { + "bg": "Инструмент за оценка проверка на духовни термини (STET)", + "ceb": "Kagamitan sa Pagsusi sa Espirituhanong mga Termino (STET)", "en": "Spiritual Terms Evaluation Tool (STET)", - "es-419": "Herramienta de Evaluación de Términos Espirituales (STET)", - "fr": "Évaluation des Termes Spirituels (STET)", + "es-419": "Herramienta de evaluación de términos espirituales (STET)", + "fr": "Outil d’évaluation des termes spirituels (STET)", "gu": "આધ્યાત્મિક શબ્દો મૂલ્યાંકન સાધન (STET)", - "pt-br": "Ferramenta de Avaliação de Termos Espirituais (STET)", - "rmn-x-yerliroman": "Инструмент за оценка на духовни термини (STET)", + "id": "Alat Evaluasi Istilah Spiritual (STET)", + "pt-br": "Ferramenta de avaliação de termos espirituais (STET)", "ru": "Инструмент оценки духовных терминов (STET)", - "sw": "Chombo cha Kutathmini Maneno ya Kiroho (STET)", - "tpi": "Tul bilong skelim ol spirit tok bilong buk trenslesen (STET)", + "sw": "Chombo cha Kutathmini Istilahi za Kiroho (STET)", + "tl": "Kagamitan sa Pagsusuri ng mga Espiritwal na Termino (STET)", + "tpi": "Tul bilong skelim ol spirituel tok (STET)", "vi": "Công cụ Đánh giá Thuật ngữ Tâm linh (STET)", } TRANSLATED_FOOTER_PHRASES_TABLE: dict[str, str] = { + "bg": "Генерирано на дата", + "ceb": "Gihimo sa", "en": "Generated on", "es-419": "Generado el", "fr": "Généré le", "gu": "તૈયાર કરેલ તારીખ", + "id": "Dibuat pada", "pt-br": "Gerado em", - "rmn-x-yerliroman": "Генерирано на", - "ru": "Сформировано", + "ru": "Создано", "sw": "Imetolewa tarehe", - "tpi": "Wok i bin kamap long", + "tl": "Nabuo noong", + "tpi": "Wokim long", "vi": "Được tạo vào", } LOCALIZED_DATE_FORMAT_STRINGS: dict[str, str] = { + "bg": "%d.%m.%Y %H:%M:%S", + "ceb": "%d/%m/%Y %H:%M:%S", "en": "%m/%d/%Y %H:%M:%S", "es-419": "%d/%m/%Y %H:%M:%S", "fr": "%d/%m/%Y %H:%M:%S", "gu": "%d/%m/%Y %H:%M:%S", + "id": "%d/%m/%Y %H:%M:%S", "pt-br": "%d/%m/%Y %H:%M:%S", - "rmn-x-yerliroman": "%d.%m.%Y %H:%M:%S", "ru": "%d.%m.%Y %H:%M:%S", "sw": "%d/%m/%Y %H:%M:%S", + "tl": "%d/%m/%Y %H:%M:%S", "tpi": "%d/%m/%Y %H:%M:%S", "vi": "%d/%m/%Y %H:%M:%S", } TRANSLATED_TABLE_COLUMN_HEADERS = { - "en": ("Source Reference", "Target Reference", "Status", "OK"), - "es-419": ("Fuente", "Idioma Materna", "Estado", "OK"), - "fr": ("Référence de source", "Référence Cible", "Statut", "OK"), - "gu": ("સ્ત્રોત લખાણનો સંદર્ભ", "લક્ષ્ય લખાણનો સંદર્ભ", "સ્થિતિ", "બરાબર છે"), - "pt-br": ("Referência de Origem", "Referência de Destino", "Status", "OK"), - "rmn-x-yerliroman": ( - "Препратка към изходния текст – текста на български", - "Препратка към преведения текст – текста на цигански", - "състояние", + "bg": ( + "Препратка към изходния текст", + "Препратка към целевия преведения текст", + "Текущо състояние", "OK", ), + "ceb": ("Gikanan nga Reperensya", "Target nga Reperensya", "Kahimtang", "OK"), + "en": ("Source Reference", "Target Reference", "Status", "OK"), + "es-419": ("Referencia de origen", "Referencia de destino", "Estado", "OK"), + "fr": ("Référence source", "Référence cible", "Statut", "OK"), + "gu": ("સ્ત્રોત લખાણનો સંદર્ભ", "લક્ષ્ય લખાણનો સંદર્ભ", "સ્થિતિ", "OK"), + "id": ("Referensi Sumber", "Referensi Target", "Status", "OK"), + "pt-br": ("Referência de Origem", "Referência de Destino", "Status", "OK"), "ru": ( "Ссылка на исходный текст", "Ссылка на переведенный текст", - "статус", - "Удовл", + "Статус", + "ОК", ), - "sw": ("Marejeo Chanzo", "Marejeo Lengwa", "Hali", "OK"), - "tpi": ("Narapela baibel ves", "Tokples ves", "Sek", "OK"), - "vi": ("Tham chiếu nguồn", "Tham chiếu đích", "Trạng thái", "Đạt"), + "sw": ("Marejeo ya Chanzo", "Marejeo ya Lengwa", "Hali", "OK"), + "tl": ("Sanggunian ng Pinagmulan", "Sanggunian ng Target", "Katayuan", "OK"), + "tpi": ("Sos referens", "Taget referens", "Stetas", "OK"), + "vi": ("Tham chiếu nguồn", "Tham chiếu đích", "Trạng thái", "OK"), } diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte index d6891609..2b8b34cf 100644 --- a/frontend/src/routes/settings/+page.svelte +++ b/frontend/src/routes/settings/+page.svelte @@ -45,9 +45,7 @@ // Only show optional settings that are relevant to the resources // the user has chosen. - let usfmRegex = new RegExp( - 'avd,.*|ayt,.*|blv,.*|cuv,.*|f10,.*|nav,.*|reg,.*|ugnt,.*|uhb,.*|ulb,.*|usfm,.*' - ) + let usfmRegex = new RegExp('\b(avd|ayt|blv|bpb|cuv|f10|nav|reg|tbi|ugnt|uhb|ulb|usfm)\b') let tnRegex = new RegExp('tn, .*') let tqRegex = new RegExp('tq, .*') let bcRegex = new RegExp('bc, .*') diff --git a/frontend/tests/e2e/stet_test.ts b/frontend/tests/e2e/stet_test.ts index ea8c0818..128b7afe 100644 --- a/frontend/tests/e2e/stet_test.ts +++ b/frontend/tests/e2e/stet_test.ts @@ -123,3 +123,16 @@ test.describe('Desktop Tests', () => { await expect(page.getByText('Tok Pisin')).not.toBeVisible({ timeout: 64_000 }) }) }) + +test('test ceb, vi, bu, present', async ({ page }) => { + await page.goto('http://localhost:8001/stet') + await expect(page.getByRole('main')).toContainText('Cebuano') + await expect(page.getByRole('main')).toContainText('Tiếng Việt (Vietnamese)') + await expect(page.getByRole('main')).toContainText('Wikang Tagalog') + await expect(page.getByRole('main')).toContainText('български език (Bulgarian)') + await page.getByText('Cebuano').click() + await page.getByRole('button', { name: 'Next' }).click() + await page.getByText('Wikang Tagalog').click() + await page.getByRole('button', { name: 'Next' }).click() + await page.getByRole('button', { name: 'Generate File' }).click() +})