Skip to content

Commit da1c27a

Browse files
fix: Fix language comparison when applying a style rule in text translate
1 parent d5fee35 commit da1c27a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
- Updated three tests to be less flakey and reflect new behavior regarding the model type.
1010
- Improved `NotFoundException` error message by removing the misleading "check server_url" suggestion.
1111

12+
### Fixed
13+
- Fixed a bug where translating with style rules would sometimes incorrectly result in
14+
a "target_lang must match style rule language" error
15+
1216
### Security
1317
- Updated dependencies to fix CVE-2025-66418 and CVE-2025-66471
1418

deepl/translator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def _check_language_and_formality(
298298
if isinstance(style_rule, StyleRuleInfo):
299299
if (
300300
Language.remove_regional_variant(target_lang)
301-
!= style_rule.language
301+
!= style_rule.language.upper()
302302
):
303303
raise ValueError("target_lang must match style rule language")
304304

0 commit comments

Comments
 (0)