17
17
* Client for the DeepL API. To use the DeepL API, initialize an instance of this class using your
18
18
* DeepL Authentication Key as found in your <a href="https://www.deepl.com/pro-account/">DeepL
19
19
* account</a>.
20
+ *
21
+ * @deprecated Use {@link DeepLClient} instead.
20
22
*/
23
+ @ Deprecated
21
24
public class Translator {
22
25
/** Base URL for DeepL API Free accounts. */
23
26
private static final String DEEPL_SERVER_URL_FREE = "https://api-free.deepl.com" ;
24
27
/** Base URL for DeepL API Pro accounts */
25
28
private static final String DEEPL_SERVER_URL_PRO = "https://api.deepl.com" ;
26
29
27
- private final Parser jsonParser = new Parser ();
28
- private final HttpClientWrapper httpClientWrapper ;
30
+ protected final Parser jsonParser = new Parser ();
31
+ protected final HttpClientWrapper httpClientWrapper ;
29
32
30
33
/**
31
34
* Initializes a new Translator object using your Authentication Key.
@@ -841,7 +844,7 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParams(
841
844
* @param options Options influencing translation.
842
845
* @return Iterable of parameters for HTTP request.
843
846
*/
844
- private static ArrayList <KeyValuePair <String , String >> createHttpParams (
847
+ protected static ArrayList <KeyValuePair <String , String >> createHttpParams (
845
848
String sourceLang , String targetLang , DocumentTranslationOptions options ) {
846
849
return createHttpParamsCommon (
847
850
sourceLang ,
@@ -861,7 +864,7 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParams(
861
864
* @param glossaryId ID of glossary to use for translation.
862
865
* @return Iterable of parameters for HTTP request.
863
866
*/
864
- private static ArrayList <KeyValuePair <String , String >> createHttpParamsCommon (
867
+ protected static ArrayList <KeyValuePair <String , String >> createHttpParamsCommon (
865
868
@ Nullable String sourceLang ,
866
869
String targetLang ,
867
870
@ Nullable Formality formality ,
@@ -920,7 +923,7 @@ private static String joinTags(Iterable<String> tags) {
920
923
* @param targetLang Language code of the desired output language.
921
924
* @throws IllegalArgumentException If either language code is invalid.
922
925
*/
923
- private static void checkValidLanguages (@ Nullable String sourceLang , String targetLang )
926
+ protected static void checkValidLanguages (@ Nullable String sourceLang , String targetLang )
924
927
throws IllegalArgumentException {
925
928
if (sourceLang != null && sourceLang .isEmpty ()) {
926
929
throw new IllegalArgumentException ("sourceLang must be null or non-empty" );
@@ -982,7 +985,7 @@ private void checkResponse(HttpResponseStream response) throws DeepLException {
982
985
* @throws DeepLException Throws {@link DeepLException} or a derived exception depending on the
983
986
* type of error.
984
987
*/
985
- private void checkResponse (
988
+ protected void checkResponse (
986
989
HttpResponse response , boolean inDocumentDownload , boolean usingGlossary )
987
990
throws DeepLException {
988
991
if (response .getCode () >= 200 && response .getCode () < 300 ) {
0 commit comments