Skip to content

Commit

Permalink
feat: add labels to apply pre-translation (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiyeoguns authored Oct 3, 2023
1 parent 55ada53 commit dd0c0e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crowdin_api/api_resources/translations/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,20 @@ def apply_pre_translation(
duplicateTranslations: Optional[bool] = None,
translateUntranslatedOnly: Optional[bool] = None,
translateWithPerfectMatchOnly: Optional[bool] = None,
labelIds: Optional[Iterable[int]] = None,
excludeLabelIds: Optional[Iterable[int]] = None,
):
"""
Apply Pre-Translation.
Link to documentation:
https://developer.crowdin.com/api/v2/#operation/api.projects.pre-translations.post
"""
if labelIds is None:
labelIds = []

if excludeLabelIds is None:
excludeLabelIds = []

return self.requester.request(
method="post",
Expand All @@ -74,6 +81,8 @@ def apply_pre_translation(
"duplicateTranslations": duplicateTranslations,
"translateUntranslatedOnly": translateUntranslatedOnly,
"translateWithPerfectMatchOnly": translateWithPerfectMatchOnly,
"labelIds": labelIds,
"excludeLabelIds": excludeLabelIds,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def test_list_project_branches(self, m_request, base_absolut_url):
"duplicateTranslations": None,
"translateUntranslatedOnly": None,
"translateWithPerfectMatchOnly": None,
"labelIds": [],
"excludeLabelIds": [],
},
),
(
Expand All @@ -57,6 +59,8 @@ def test_list_project_branches(self, m_request, base_absolut_url):
"duplicateTranslations": False,
"translateUntranslatedOnly": False,
"translateWithPerfectMatchOnly": False,
"labelIds": [1],
"excludeLabelIds": [1],
},
{
"languageIds": ["some", "language"],
Expand All @@ -67,6 +71,8 @@ def test_list_project_branches(self, m_request, base_absolut_url):
"duplicateTranslations": False,
"translateUntranslatedOnly": False,
"translateWithPerfectMatchOnly": False,
"labelIds": [1],
"excludeLabelIds": [1],
},
),
),
Expand Down

0 comments on commit dd0c0e7

Please sign in to comment.