Skip to content

Commit 31c646d

Browse files
fix: always send SentenceSplittingMode in requests
1 parent 63536dc commit 31c646d

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## [Unreleased]
9+
### Fixed
10+
* Always send SentenceSplittingMode option in requests.
11+
* [#3](https://github.com/DeepLcom/deepl-java/issues/3) thanks to
12+
[nicStuff](https://github.com/nicStuff)
13+
14+
815
## [1.0.0] - 2022-12-15
916
### Added
1017
* Add support for glossary management functions.
@@ -53,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5360
Initial version.
5461

5562

63+
[Unrelased]: https://github.com/DeepLcom/deepl-java/compare/v1.0.0...HEAD
5664
[1.0.0]: https://github.com/DeepLcom/deepl-java/compare/v0.2.1...v1.0.0
5765
[0.2.1]: https://github.com/DeepLcom/deepl-java/compare/v0.2.0...v0.2.1
5866
[0.2.0]: https://github.com/DeepLcom/deepl-java/compare/v0.1.3...v0.2.0

deepl-java/src/main/java/com/deepl/api/Translator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,15 +765,17 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParams(
765765

766766
if (options != null) {
767767
// Note: formality and glossaryId are added above
768-
if (options.getSentenceSplittingMode() != null
769-
&& options.getSentenceSplittingMode() != SentenceSplittingMode.All) {
768+
if (options.getSentenceSplittingMode() != null) {
770769
switch (options.getSentenceSplittingMode()) {
771770
case Off:
772771
params.add(new KeyValuePair<>("split_sentences", "0"));
773772
break;
774773
case NoNewlines:
775774
params.add(new KeyValuePair<>("split_sentences", "nonewlines"));
776775
break;
776+
case All:
777+
params.add(new KeyValuePair<>("split_sentences", "1"));
778+
break;
777779
default:
778780
break;
779781
}

0 commit comments

Comments
 (0)