Learning with Texts - Fork  2.10.0-fork
Learn foreign languages with texts
Namespaces | Functions
ajax_add_term_transl.php File Reference

Add a translation to term. More...

Namespaces

 Lwt
 

Functions

 add_new_term_transl ($text, $lang, $data)
 
 edit_term_transl ($wid, $new_trans)
 
 do_ajax_check_update_translation ($wid, $new_trans)
 
 do_ajax_add_term_transl ($wid, $data)
 

Detailed Description

Add a translation to term.

Call: inc/ajax_add_term_transl.php

Function Documentation

◆ add_new_term_transl()

add_new_term_transl (   $text,
  $lang,
  $data 
)

Add the translation for a new term.

Parameters
string$textAssociated text
int$langLanguage ID
string$dataTranslation
Returns
(int|string)[]|string [new word ID, lowercase $text] if success, error message otherwise

@global string $tbpref Database table prefix

Since
2.9.0 Error messages are much more explicit
2.9.0 Return an array

@psalm-return list{int, string}|string

◆ do_ajax_add_term_transl()

do_ajax_add_term_transl (   $wid,
  $data 
)

Add or edit a term translation.

Parameters
int$widWord ID
string$dataTranslation
Returns
string Database alteration message
Deprecated:
Deprecated in 2.9.0 in favor to the REST API.

◆ do_ajax_check_update_translation()

do_ajax_check_update_translation (   $wid,
  $new_trans 
)

Edit term translation if it exists.

Parameters
int$widWord ID
string$new_transNew translation
Returns
string Term in lower case, or error message if term does not exist

@global string $tbpref

◆ edit_term_transl()

edit_term_transl (   $wid,
  $new_trans 
)

Edit the translation for an existing term.

Parameters
int$widWord ID
string$new_transNew translation
Returns
string WoTextLC, lowercase version of the word

@global string $tbpref Database table prefix