Documentation

TermImportController extends VocabularyBaseController
in package

Controller for bulk translate and file import operations.

Handles:

  • /word/upload - Import terms from file
  • /word/bulk-translate - Bulk translate terms
Tags
since
3.0.0

Table of Contents

Properties

$bulkService  : WordBulkService|null
$contextService  : WordContextService|null
$crudService  : WordCrudService|null
Lazy-loaded services.
$discoveryService  : WordDiscoveryService|null
$expressionService  : ExpressionService|null
$linkingService  : WordLinkingService|null
$multiWordService  : MultiWordService|null
$sentenceService  : SentenceService|null
$textStatisticsService  : TextStatisticsService|null
$uploadService  : WordUploadService|null
$viewPath  : string
View base path.
$languageFacade  : LanguageFacade
Language facade.

Methods

__construct()  : mixed
Constructor.
bulkTranslate()  : void
Bulk translate words.
setViewPath()  : void
Set custom view path.
upload()  : void
Upload words from file.
getBulkService()  : WordBulkService
Get WordBulkService (lazy loaded).
getContextService()  : WordContextService
Get WordContextService (lazy loaded).
getCrudService()  : WordCrudService
Get WordCrudService (lazy loaded).
getDiscoveryService()  : WordDiscoveryService
Get WordDiscoveryService (lazy loaded).
getExpressionService()  : ExpressionService
Get ExpressionService (lazy loaded).
getLinkingService()  : WordLinkingService
Get WordLinkingService (lazy loaded).
getMultiWordService()  : MultiWordService
Get MultiWordService (lazy loaded).
getSentenceService()  : SentenceService
Get SentenceService (lazy loaded).
getTextStatisticsService()  : TextStatisticsService
Get TextStatisticsService (lazy loaded).
getUploadService()  : WordUploadService
Get WordUploadService (lazy loaded).
render()  : void
Render a view.
displayBulkTranslateForm()  : void
Display the bulk translate form.
displayUploadForm()  : void
Display the word upload form.
handleBulkSave()  : void
Handle saving bulk translated terms.
handleUploadImport()  : void
Handle the word import operation.
importTerms()  : void
Import terms from the uploaded file.

Properties

Methods

bulkTranslate()

Bulk translate words.

public bulkTranslate(array<string, string> $params) : void
Parameters
$params : array<string, string>

Route parameters

setViewPath()

Set custom view path.

public setViewPath(string $path) : void
Parameters
$path : string

View path

upload()

Upload words from file.

public upload(array<string, string> $params) : void
Parameters
$params : array<string, string>

Route parameters

render()

Render a view.

protected render(string $view[, array<string|int, mixed> $data = [] ]) : void
Parameters
$view : string

View name (without .php)

$data : array<string|int, mixed> = []

View data

displayBulkTranslateForm()

Display the bulk translate form.

private displayBulkTranslateForm(int $tid, string|null $sl, string|null $tl, int $pos) : void
Parameters
$tid : int

Text ID

$sl : string|null

Source language code

$tl : string|null

Target language code

$pos : int

Offset position

Tags
psalm-suppress

UnresolvableInclude Path computed from viewPath property

displayUploadForm()

Display the word upload form.

private displayUploadForm() : void
Tags
psalm-suppress

UnresolvableInclude Path computed from viewPath property

handleBulkSave()

Handle saving bulk translated terms.

private handleBulkSave(array<int, array{lg: int, text: string, status: int, trans?: string}> $terms, int $tid, bool $cleanUp) : void
Parameters
$terms : array<int, array{lg: int, text: string, status: int, trans?: string}>

Array of term data

$tid : int

Text ID

$cleanUp : bool

Whether to clean up right frames after save

Tags
psalm-suppress

UnusedParam $tid and $cleanUp are used in included view file

psalm-suppress

UnresolvableInclude Path computed from viewPath property

handleUploadImport()

Handle the word import operation.

private handleUploadImport() : void
Tags
psalm-suppress

UnresolvableInclude Path computed from viewPath property

importTerms()

Import terms from the uploaded file.

private importTerms(WordUploadService $uploadService, int $langId, array{txt: int, tr: int, ro: int, se: int, tl: int} $fields, array<int, string> $col, string $tabType, string $fileName, int $status, int $overwrite, bool $ignoreFirst, string $translDelim, string $lastUpdate) : void
Parameters
$uploadService : WordUploadService

The upload service

$langId : int

Language ID

$fields : array{txt: int, tr: int, ro: int, se: int, tl: int}

Field indexes

$col : array<int, string>

Column mapping

$tabType : string

Tab type (c, t, h)

$fileName : string

Path to input file

$status : int

Word status

$overwrite : int

Overwrite mode

$ignoreFirst : bool

Ignore first line

$translDelim : string

Translation delimiter

$lastUpdate : string

Last update timestamp


        
On this page

Search results