class TranslateAction

Traits

Properties

TranslationController $mod from  CommonOperationsTrait

Methods

buildLangStrings()

Builds a map of available system languages in $lang_strings: ['de' => 'DE_DE', 'en' => 'EN_GB', ...]

createTranslationJob(string $content, string $target_model, int $target_id, string $language, bool $add_to_search_index = true, int $priority = 1)

Creates a translation_job model

void
createTranslationJobs(string $content, string $target_model, int $target_id, array $languages, bool $add_to_search_index = false, $priority = 1)

Creates translation jobs in the translation job queue to translate $content into $languages

string
getDbLanguageString(string $language)

No description

array
getLangStrings()

Getter for $lang_strings

array
processTranslationJob(TranslationJob $translationJob)

Processes the TranslationJob

array
translate(string $content, string $target_language)

No description

void
updateTranslationCounter(string $language, string $content)

Updates the translation_counter table with info about the translated content

Details

protected buildLangStrings()

Builds a map of available system languages in $lang_strings: ['de' => 'DE_DE', 'en' => 'EN_GB', ...]

TranslationJob createTranslationJob(string $content, string $target_model, int $target_id, string $language, bool $add_to_search_index = true, int $priority = 1)

Creates a translation_job model

Parameters

string $content
string $target_model
int $target_id
string $language
bool $add_to_search_index
int $priority

Return Value

TranslationJob

at line 74
void createTranslationJobs(string $content, string $target_model, int $target_id, array $languages, bool $add_to_search_index = false, $priority = 1)

Creates translation jobs in the translation job queue to translate $content into $languages

Parameters

string $content

The content to translate

string $target_model

['translation_document'|'translation']

int $target_id

The model id

array $languages

Translate to this languages ['DE_DE','EN_GB', ...]

bool $add_to_search_index

Flag to add the translations to the search index

$priority

Return Value

void

Exceptions

Exception

string getDbLanguageString(string $language)

No description

Parameters

string $language

The language to get the db string for eg.: 'de'

Return Value

string

$db_string The i18n db field representation of lang eg.: 'DE_DE'

Exceptions

TranslationException

If language string could not be mapped

array getLangStrings()

Getter for $lang_strings

Return Value

array

at line 118
array processTranslationJob(TranslationJob $translationJob)

Processes the TranslationJob

Parameters

TranslationJob $translationJob

Return Value

array

$result The translation result: ['content_original'=>[...],'content_translated'=>[...],'language_source'=>'en','language_target'=>'de','errors'=>[]]

Exceptions

Exception

at line 24
array translate(string $content, string $target_language)

No description

Parameters

string $content

The content to translate

string $target_language

The target language

Return Value

array

at line 240
protected void updateTranslationCounter(string $language, string $content)

Updates the translation_counter table with info about the translated content

Parameters

string $language
string $content

Return Value

void

Exceptions

Exception