class DeepL::Translator

Overview

DEPRECATED Use V3 MultilingualGlossaryInfo instead

Defined in:

deepl/translator.cr
deepl/v2/document.cr
deepl/v2/glossary.cr
deepl/v2/language.cr
deepl/v2/rephrase.cr
deepl/v2/text.cr
deepl/v2/usage.cr
deepl/v3/glossary.cr

Constant Summary

DEEPL_API_VERSION = {{ (env("DEEPL_API_VERSION")) || "v2" }}
DEEPL_DEFAULT_SERVER_URL = "https://api.deepl.com"

Note: The default server URL is set during the compilation process. To change the default server URL, you need to recompile the code.

DEEPL_DEFAULT_SERVER_URL_FREE = "https://api-free.deepl.com"
DEEPL_SERVER_URL = {{ (env("DEEPL_SERVER_URL")) || DEEPL_DEFAULT_SERVER_URL }}
DEEPL_SERVER_URL_FREE = {{ (env("DEEPL_SERVER_URL_FREE")) || DEEPL_DEFAULT_SERVER_URL_FREE }}
HTTP_STATUS_QUOTA_EXCEEDED = 456

Constructors

Instance Method Summary

Constructor Detail

def self.new(auth_key : Nil | String = nil, user_agent : Nil | String = nil, server_url : Nil | String = nil) #

[View source]

Instance Method Detail

def auth_key : String #

[View source]
def auth_key=(auth_key : String | Nil) #

[View source]
def create_glossary(name, source_lang, target_lang, entries, entry_format = "tsv") : GlossaryInfo #

[View source]
def create_multilingual_glossary(name : String, dictionaries : Array(GlossaryDictionary)) : MultilingualGlossaryInfo #

Create a multilingual glossary with specified name and dictionaries


[View source]
def delete_glossary(glossary : GlossaryInfo) : Bool #

[View source]
def delete_glossary(glossary_id : String) : Bool #

[View source]
def delete_glossary_by_name(name : String) : Bool #

[View source]
def delete_multilingual_glossary(glossary_id : String) : Bool #

Delete a multilingual glossary by ID


[View source]
def delete_multilingual_glossary(glossary : MultilingualGlossaryInfo) : Bool #

Delete a multilingual glossary (convenience method)


[View source]
def delete_multilingual_glossary_dictionary(glossary_id : String, source_lang : String, target_lang : String) : Bool #

Delete a dictionary from the glossary


[View source]
def find_glossary_info_by_name(name : String) : GlossaryInfo #

[View source]
def find_multilingual_glossary_by_name(name : String) : MultilingualGlossaryInfo #

Find multilingual glossary by name


[View source]
def get_glossary_entries(glossary : GlossaryInfo) : String #

[View source]
def get_glossary_entries(glossary_id : String) : String #

[View source]
def get_glossary_entries_by_name(name : String) : String #

[View source]
def get_glossary_info(glossary_id : String) : GlossaryInfo #

[View source]
def get_glossary_info_by_name(name : String) : Array(GlossaryInfo) #

[View source]
def get_glossary_language_pairs : Array(GlossaryLanguagePair) #

[View source]
def get_multilingual_glossaries_by_name(name : String) : Array(MultilingualGlossaryInfo) #

Get multilingual glossaries by name (multiple matches possible)


[View source]
def get_multilingual_glossary(glossary_id : String) : MultilingualGlossaryInfo #

Get multilingual glossary details by ID


[View source]
def get_multilingual_glossary_entries(glossary_id : String, source_lang : String, target_lang : String) : GlossaryDictionary #

Get glossary entries for specific language pair


[View source]
def get_multilingual_glossary_entries(glossary : MultilingualGlossaryInfo, source_lang : String, target_lang : String) : GlossaryDictionary #

Get glossary entries (convenience method)


[View source]
def get_multilingual_glossary_language_pairs : Array(MultilingualGlossaryLanguagePair) #

Get supported language pairs for multilingual glossaries


[View source]
def get_source_languages : Array(LanguageInfo) #

[View source]
def get_target_languages : Array(LanguageInfo) #

[View source]
def get_usage : Usage #

[View source]
def get_usage_free : UsageFree #

[View source]
def get_usage_pro : UsagePro #

[View source]
def guess_target_language : String #

[View source]
def list_glossaries : Array(GlossaryInfo) #

[View source]
def list_multilingual_glossaries : Array(MultilingualGlossaryInfo) #

List all multilingual glossaries and their meta-information


[View source]
def patch_multilingual_glossary(glossary_id : String, name : String | Nil = nil, dictionaries : Array(GlossaryDictionary) | Nil = nil) : MultilingualGlossaryInfo #

Edit glossary details (name or dictionaries)


[View source]
def put_multilingual_glossary_dictionary(glossary_id : String, source_lang : String, target_lang : String, entries : String, entries_format : String = "tsv") : GlossaryEntriesInformation #

Replace or create a dictionary in the glossary


[View source]
def rephrase_text(text : String | Array(String), target_lang = nil, writing_style = nil, tone = nil) : Array(RephraseResult) #

[View source]
def server_url : String #

[View source]
def server_url=(server_url : String | Nil) #

[View source]
def translate_document(path, target_lang, source_lang = nil, formality = nil, glossary_id = nil, glossary_name = nil, output_format = nil, output_file = nil, interval = 5.0, message_prefix = "[deepl.cr] ", &block : String -> ) #

[View source]
def translate_document(path, target_lang, source_lang = nil, formality = nil, glossary_id = nil, glossary_name = nil, output_format = nil, output_file = nil, interval = 5.0, message_prefix = "[deepl.cr] ", block : String -> | Nil = nil) #

[View source]
def translate_document_download(handle : DocumentHandle, output_file) #

[View source]
def translate_document_get_status(handle : DocumentHandle) : DocumentStatus #

[View source]
def translate_document_upload(path : Path | String, target_lang, source_lang = nil, formality = nil, glossary_id = nil, glossary_name = nil, output_format = nil) : DocumentHandle #

[View source]
def translate_document_wait_until_done(handle : DocumentHandle, interval = 5.0, &block : DocumentStatus -> ) #

[View source]
def translate_document_wait_until_done(handle : DocumentHandle, interval = 5.0, block : DocumentStatus -> | Nil = nil) #

[View source]
def translate_text(text : String | Array(String), target_lang, source_lang = nil, context = nil, show_billed_characters : Bool | Nil = nil, split_sentences = nil, preserve_formatting : Bool | Nil = nil, formality = nil, glossary_id = nil, glossary_name = nil, tag_handling = nil, outline_detection : Bool | Nil = nil, non_splitting_tags : Array(String) | Nil = nil, splitting_tags : Array(String) | Nil = nil, ignore_tags : Array(String) | Nil = nil, model_type = nil) : Array(TextResult) #

[View source]
def user_agent : String #

[View source]
def user_agent=(user_agent : String | Nil) #

[View source]