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

NO-OP version of TTMServer when it is disabled. More...

Inheritance diagram for FakeTTMServer:
TTMServer MediaWiki\Extension\Translate\TtmServer\ReadableTtmServer MediaWiki\Extension\Translate\TtmServer\WritableTtmServer

Public Member Functions

 query (string $sourceLanguage, string $targetLanguage, string $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.
 
 update (MessageHandle $handle, ?string $targetText)
 Shovels the new translation into translation memory.
 
 beginBootstrap ()
 Called when starting to fill the translation memory.
 
 beginBatch ()
 Called before every batch (MessageGroup).
 
 batchInsertDefinitions (array $batch)
 Called multiple times per batch if necessary.
 
 batchInsertTranslations (array $batch)
 Called multiple times per batch if necessary.
 
 endBatch ()
 Called after every batch (MessageGroup).
 
 endBootstrap ()
 Do any cleanup, optimizing etc.
 
 getMirrors ()
 
 setDoReIndex ()
 Instruct the service to fully wipe the index and start from scratch.
 
- Public Member Functions inherited from TTMServer
 __construct (array $config)
 

Additional Inherited Members

- Static Public Member Functions inherited from TTMServer
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

NO-OP version of TTMServer when it is disabled.

Keeps other code simpler when they can just do TTMServer::primary()->update( ... );

Since
2012-01-28

Definition at line 22 of file FakeTTMServer.php.

Constructor & Destructor Documentation

◆ __construct()

FakeTTMServer::__construct ( )

Definition at line 23 of file FakeTTMServer.php.

Member Function Documentation

◆ batchInsertDefinitions()

FakeTTMServer::batchInsertDefinitions ( array $batch)

Called multiple times per batch if necessary.

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 49 of file FakeTTMServer.php.

◆ batchInsertTranslations()

FakeTTMServer::batchInsertTranslations ( array $batch)

Called multiple times per batch if necessary.

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 52 of file FakeTTMServer.php.

◆ beginBatch()

FakeTTMServer::beginBatch ( )

Called before every batch (MessageGroup).

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 46 of file FakeTTMServer.php.

◆ beginBootstrap()

FakeTTMServer::beginBootstrap ( )

Called when starting to fill the translation memory.

Set up necessary variables and remove old content from the server.

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 43 of file FakeTTMServer.php.

◆ endBatch()

FakeTTMServer::endBatch ( )

Called after every batch (MessageGroup).

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 55 of file FakeTTMServer.php.

◆ endBootstrap()

FakeTTMServer::endBootstrap ( )

Do any cleanup, optimizing etc.

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 58 of file FakeTTMServer.php.

◆ expandLocation()

FakeTTMServer::expandLocation ( array $suggestion)

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

Returns
string URL

Implements MediaWiki\Extension\Translate\TtmServer\ReadableTtmServer.

Definition at line 35 of file FakeTTMServer.php.

◆ getMirrors()

FakeTTMServer::getMirrors ( )
Deprecated
Since MLEB 2023.04
Returns
string[]

Reimplemented from TTMServer.

Definition at line 61 of file FakeTTMServer.php.

◆ isLocalSuggestion()

FakeTTMServer::isLocalSuggestion ( array $suggestion)

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

Implements MediaWiki\Extension\Translate\TtmServer\ReadableTtmServer.

Definition at line 31 of file FakeTTMServer.php.

◆ query()

FakeTTMServer::query ( string $sourceLanguage,
string $targetLanguage,
string $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 MediaWiki\Extension\Translate\TtmServer\ReadableTtmServer.

Definition at line 27 of file FakeTTMServer.php.

◆ setDoReIndex()

FakeTTMServer::setDoReIndex ( )

Instruct the service to fully wipe the index and start from scratch.

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 65 of file FakeTTMServer.php.

◆ update()

FakeTTMServer::update ( MessageHandle $handle,
?string $targetText )

Shovels the new translation into translation memory.

Use this for single updates (=after message edit). If no text is provided, entry will be removed from the translation memory.

Parameters
MessageHandle$handle
string | null$targetTextUse null to only delete.

Implements MediaWiki\Extension\Translate\TtmServer\WritableTtmServer.

Definition at line 39 of file FakeTTMServer.php.


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