class DeepL::Translator

Defined in:

deepl/translator.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 delete_glossary(glossary : GlossaryInfo) #

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

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

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

[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_source_languages : Array(LanguageInfo) #

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

[View source]
def get_usage #

[View source]
def guess_target_language : String #

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

[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]