See
PublishedAPI for packages intended to be used by Plugin and Contrib authors, or
browse all packages.
See also
Developing plugins,
Developer's Bible,
Technical Overview
internal package Foswiki::Plugins::DeeplPlugin::Core
core class for this plugin
an singleton instance is allocated on demand
ClassMethod new() → $core
constructor for a Core object
ObjectMethod finish()
makes sure all sub-objects are deconstructed as well
ObjectMethod DEEPL($params, $topic, $web) → $string
implements the %DEEPL macro
ObjectMethod DEEPL_LANGUAGES($params, $topic, $web) → $string
implements the %DEEPL_LANGUAGES macro
ObjectMethod jsonRpcTranslate($session, $request)
JSON-RPC implementation of the
translate endpoint
ObjectMethod jsonRpcUpload($session, $request)
JSON-RPC implementation of the
upload endpoint
ObjectMethod jsonRpcStatus($session, $request)
JSON-RPC implementation for the
status endpoint
ObjectMethod restDownload($session)
REST handler for the
download endpoint
ObjectMethod handleDeeplSection()
takes care of content passed down from
%STARTDEPPL ...
%ENDDEEPL section.
ObjectMethod translate($text, $params) → $result
Perl api to translate a text using deepl.
The $params has may contain
the following keys:
- text (used when
$tet isn't defined)
- source_lang
- target_lang
- context
- split_sentences
- preserve_formatting
- formality: default, more, less, prefer_more, prefer_less
- model_type: quality_optimized, prefer_quality_optimized, latency_optimized
- glossary_id
- tag_handling
- outline_detection
- non_splitting_tags
- splitting_tags
- ignore_tags
See
https://www.deepl.com/de/docs-api/translate-text/translate-text for more information
on the request parameters.
ObjectMethod upload($info, $params)
ObjectMethod status($id, $key)
ObjectMethod download($id, $key) → $data
ObjectMethod translateTopic($meta, $sourceLang, $targetLang, $fields) → $changed
Translates a topic from a source to a target language. The
$fields parameter holds
a list of names of meta data to be translated. These are either formfield names or
"text" and "attachments". If "attachments" are listed in
$fields will all comments
of all attachments be translated.
Information is read from
$meta and stored back into
$meta.
A boolean value
$changed will be returned when a field has been translated successfully.
ObjectMethod userLanguage() → $langTag
returns the language of the current user session
ObjectMethod languages($type) → $list
returns a list of languages supported by deepl. The
$type
parameter specifies whether
source or
target languages are
requested, defaulting to
source. Note that available source and
target languages might not be the same.
ObjectMethod json() → $json
returns a JSON singleton object for all things json
ObjectMethod ua() → $ua
returns a LWP::UserAgent singleton object
ObjectMethod getCache() → $cache
returns a
Foswiki::Contrib::CacheContrib cache object