Documentation

TermTranslationApiHandler
in package

Handler for term translation, dictionary, and tag API operations.

Provides endpoints for:

  • Getting similar terms for autocomplete
  • Dictionary link generation
  • Term tag management
  • Translation creation and updates
Tags
since
3.0.0

Table of Contents

Properties

$dictionaryAdapter  : DictionaryAdapter
$findSimilarTerms  : FindSimilarTerms

Methods

__construct()  : mixed
Constructor.
addNewTermTranslation()  : array{success: bool, wordId?: int, textLc?: string, error?: string, affected?: int}
Add the translation for a new term.
checkUpdateTranslation()  : array{success: bool, textLc?: string, error?: string, count?: int}
Edit term translation if it exists.
editTermTranslation()  : string
Edit the translation for an existing term.
formatAddTranslation()  : array{error?: string, add?: string, term_id?: int|string, term_lc?: string}
Format response for adding translation.
formatDictionaryLinks()  : array<string|int, mixed>
Format response for dictionary links.
formatSimilarTerms()  : array<string|int, mixed>
Format response for similar terms.
formatUpdateTranslation()  : array{update?: string, error?: string}
Format response for updating translation.
getDictionaryLinks()  : array<string|int, mixed>
Get dictionary links for a term.
getSimilarTerms()  : array{similar_terms: string}
Get similar terms.
getTermTags()  : array{tags: string[]}
Get tags for a term.
setTermTags()  : array{success: bool}
Set tags for a term.

Properties

Methods

addNewTermTranslation()

Add the translation for a new term.

public addNewTermTranslation(string $text, int $lang, string $data) : array{success: bool, wordId?: int, textLc?: string, error?: string, affected?: int}
Parameters
$text : string

Associated text

$lang : int

Language ID

$data : string

Translation

Return values
array{success: bool, wordId?: int, textLc?: string, error?: string, affected?: int}

Result with wordId and textLc on success, or error details on failure

checkUpdateTranslation()

Edit term translation if it exists.

public checkUpdateTranslation(int $wid, string $newTrans) : array{success: bool, textLc?: string, error?: string, count?: int}
Parameters
$wid : int

Word ID

$newTrans : string

New translation

Return values
array{success: bool, textLc?: string, error?: string, count?: int}

Result with textLc on success, or error details on failure

editTermTranslation()

Edit the translation for an existing term.

public editTermTranslation(int $wid, string $newTrans) : string
Parameters
$wid : int

Word ID

$newTrans : string

New translation

Return values
string

WoTextLC, lowercase version of the word

formatAddTranslation()

Format response for adding translation.

public formatAddTranslation(string $termText, int $lgId, string $translation) : array{error?: string, add?: string, term_id?: int|string, term_lc?: string}
Parameters
$termText : string

Term text

$lgId : int

Language ID

$translation : string

Translation

Return values
array{error?: string, add?: string, term_id?: int|string, term_lc?: string}

Format response for dictionary links.

public formatDictionaryLinks(int $langId, string $term) : array<string|int, mixed>
Parameters
$langId : int

Language ID

$term : string

Term text

Return values
array<string|int, mixed>

formatSimilarTerms()

Format response for similar terms.

public formatSimilarTerms(int $langId, string $term) : array<string|int, mixed>
Parameters
$langId : int

Language ID

$term : string

Term text

Return values
array<string|int, mixed>

formatUpdateTranslation()

Format response for updating translation.

public formatUpdateTranslation(int $termId, string $translation) : array{update?: string, error?: string}
Parameters
$termId : int

Term ID

$translation : string

New translation

Return values
array{update?: string, error?: string}

Get dictionary links for a term.

public getDictionaryLinks(int $langId, string $term) : array<string|int, mixed>
Parameters
$langId : int

Language ID

$term : string

Term text

Return values
array<string|int, mixed>

Dictionary URLs

getSimilarTerms()

Get similar terms.

public getSimilarTerms(int $langId, string $term) : array{similar_terms: string}
Parameters
$langId : int

Language ID

$term : string

Term text

Return values
array{similar_terms: string}

getTermTags()

Get tags for a term.

public getTermTags(int $termId) : array{tags: string[]}
Parameters
$termId : int

Term ID

Return values
array{tags: string[]}

setTermTags()

Set tags for a term.

public setTermTags(int $termId, array<string|int, string> $tags) : array{success: bool}
Parameters
$termId : int

Term ID

$tags : array<string|int, string>

Tag names

Return values
array{success: bool}

        
On this page

Search results