Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crowdin_api/api_resources/string_translations/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,14 @@ def add_translation(
text: str,
projectId: Optional[int] = None,
pluralCategoryName: Optional[PluralCategoryName] = None,
addToTm: Optional[bool] = None,
):
"""
Add Translation.

Link to documentation:
https://developer.crowdin.com/api/v2/#operation/api.projects.translations.post
"""

projectId = projectId or self.get_project_id()

return self.requester.request(
Expand All @@ -267,6 +267,7 @@ def add_translation(
"languageId": languageId,
"text": text,
"pluralCategoryName": pluralCategoryName,
"addToTm": addToTm,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba
"languageId": "ua",
"text": "text",
"pluralCategoryName": None,
"addToTm": None,
},
),
(
Expand All @@ -353,6 +354,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba
"languageId": "ua",
"text": "text",
"pluralCategoryName": "some name",
"addToTm": None,
},
),
),
Expand All @@ -362,7 +364,7 @@ def test_add_translation(self, m_request, in_params, request_data, base_absolut_
m_request.return_value = "response"

resource = self.get_resource(base_absolut_url)
assert resource.add_translation(projectId=1, **request_data) == "response"
assert resource.add_translation(projectId=1, **in_params) == "response"
m_request.assert_called_once_with(
method="post",
path=resource.get_translations_path(projectId=1),
Expand Down