Translate extension for MediaWiki
 
Loading...
Searching...
No Matches

Class for handling remote TTMServers over MediaWiki API. More...

Inheritance diagram for RemoteTTMServer:
TTMServer ReadableTTMServer

Public Member Functions

 query ( $sourceLanguage, $targetLanguage, $text)
 Fetches all relevant suggestions for given text.
 
 isLocalSuggestion (array $suggestion)
 Determines if the suggestion returned by this TTMServer comes from this wiki or any other wiki.
 
 expandLocation (array $suggestion)
 Given suggestion returned by this TTMServer, constructs fully qualified URL to the location of the translation.
 
- Public Member Functions inherited from TTMServer
 __construct (array $config)
 
 getMirrors ()
 
 isFrozen ()
 

Additional Inherited Members

- Static Public Member Functions inherited from TTMServer
static factory (array $config)
 
static primary ()
 Returns the primary server instance, useful for chaining.
 
static sortSuggestions (array $suggestions)
 
static levenshtein ( $str1, $str2, $length1, $length2)
 PHP implementation of Levenshtein edit distance algorithm.
 
static onDelete (WikiPage $wikipage)
 Hook: ArticleDeleteComplete.
 
static onChange (MessageHandle $handle)
 Called from TranslateEditAddons::onSave.
 
static onGroupChange (MessageHandle $handle, $old)
 
- Protected Attributes inherited from TTMServer
 $config
 

Detailed Description

Class for handling remote TTMServers over MediaWiki API.

Currently querying is done in TranslationHelpers, and this class only handles location retrieval.

Since
2012-06-27

Definition at line 19 of file RemoteTTMServer.php.

Member Function Documentation

◆ expandLocation()

RemoteTTMServer::expandLocation ( array $suggestion)

Given suggestion returned by this TTMServer, constructs fully qualified URL to the location of the translation.

Parameters
array$suggestion
Returns
string URL

Implements ReadableTTMServer.

Definition at line 29 of file RemoteTTMServer.php.

◆ isLocalSuggestion()

RemoteTTMServer::isLocalSuggestion ( array $suggestion)

Determines if the suggestion returned by this TTMServer comes from this wiki or any other wiki.

Parameters
array$suggestion
Returns
bool

Implements ReadableTTMServer.

Definition at line 25 of file RemoteTTMServer.php.

◆ query()

RemoteTTMServer::query ( $sourceLanguage,
$targetLanguage,
$text )

Fetches all relevant suggestions for given text.

Parameters
string$sourceLanguagelanguage code for the provide text
string$targetLanguagelanguage code for the suggestions
string$textthe text for which to search suggestions
Returns
array List: unordered suggestions, which each has fields:
  • source: String: the original text of the suggestion
  • target: String: the suggestion
  • context: String: title of the page where the suggestion comes from
  • quality: Float: the quality of suggestion, 1 is perfect match

Implements ReadableTTMServer.

Definition at line 20 of file RemoteTTMServer.php.


The documentation for this class was generated from the following file: