![]() |
Xataface Translation Memory Module 0.1
Translation Memory for Xataface Applications
|
Public Member Functions | |
__construct (Dataface_Record $rec) | |
Creates a new TranslationMemory record that wraps a record of the xf_tm_translation_memories table. | |
getRecord () | |
Gets the encapsulated xf_tm_translation_memories record. | |
getSourceLanguage () | |
Gets the 2-digit language code of the source language of this translation memory. | |
getDestinationLanguage () | |
Gets the 2-digit language code of the destination language of this translation memory. | |
assignTo ($recid, $secure=false) | |
Assigns the current translation memory to the record with the specified id. | |
addTranslation ($string, $translation, $username=null, $secure=false) | |
Adds a translation to the current translation memory. If the translation already exists in the system then that same translation will be linked to the translation memory. Otherwise the translation will be created and linked. | |
containsTranslation ($string, $translation) | |
Checks if the current translation memory contains the specified translation. | |
findTranslation ($string, $translation) | |
Finds the translation record for the given translation. | |
scoreTranslation ($string, $translation, $score, $username=null, $secure=false) | |
Scores a translation. | |
setTranslationStatus ($string, $translation, $status, $username=null, $secure=false) | |
Sets the status of a translation. Should be one of. | |
addTranslationComment ($string, $translation, $comment, $username=null, $secure=false) | |
Adds a comment to a translation. | |
getTranslations (array $sources, $minStatus=3, $maxStatus=5) | |
Gets translated strings corresponding to the given source strings. | |
Static Public Member Functions | |
static | getDefaultTranslationMemory ($source, $dest, $secure=false) |
Gets the default translation memory for the given source and destination languages. | |
static | loadTranslationMemoryById ($id) |
Loads a translation memory by its translation_memory_id. | |
static | loadTranslationMemoryFor (Dataface_Record $record, $source, $dest) |
Loads the translation memory for a given record. | |
static | findString ($string, $language) |
Finds a record encapsulating the given string. | |
static | addString ($string, $language, $secure=false) |
Adds the given string to the database. | |
Data Fields | |
const | TRANSLATION_REJECTED = 1 |
const | TRANSLATION_SUBMITTED = 3 |
const | TRANSLATION_APPROVED = 5 |
Class that handles all of the translation memory functionality.
Definition at line 28 of file XFTranslationMemory.php.
__construct | ( | Dataface_Record $ | rec | ) |
Creates a new TranslationMemory record that wraps a record of the xf_tm_translation_memories table.
Dataface_Record | $rec | A record from the xf_tm_translation_memories table. |
Definition at line 49 of file XFTranslationMemory.php.
static addString | ( | $ | string, |
$ | language, | ||
$ | secure = false |
||
) | [static] |
Adds the given string to the database.
string | $string | The string to be added. |
string | $language | The 2-digit language code of the language for the string. |
boolean | $secure | True if adding the string should be subject to Xataface permissions. |
Definition at line 355 of file XFTranslationMemory.php.
addTranslation | ( | $ | string, |
$ | translation, | ||
$ | username = null , |
||
$ | secure = false |
||
) |
Adds a translation to the current translation memory. If the translation already exists in the system then that same translation will be linked to the translation memory. Otherwise the translation will be created and linked.
string | $string | The source string. |
string | $translation | The translated string. |
string | $username | The username of the user who is adding the string. If omitted it will use the currently logged-in user. |
boolean | $secure | True if adding this translation should be subject to xataface permissions. |
Definition at line 250 of file XFTranslationMemory.php.
addTranslationComment | ( | $ | string, |
$ | translation, | ||
$ | comment, | ||
$ | username = null , |
||
$ | secure = false |
||
) |
Adds a comment to a translation.
string | $string | The source string (or int string id). |
string | $translation | The translated string (or int translation id) |
string | $username | The usernmae of hte user who is adding the comment (default to logged in user). |
boolean | $secure | True if adding the comment should be subject to xataface permissions. |
Definition at line 515 of file XFTranslationMemory.php.
assignTo | ( | $ | recid, |
$ | secure = false |
||
) |
Assigns the current translation memory to the record with the specified id.
string | $recid | The ID of the record to assign this translation memory to. '*' for default. |
boolean | $secure | True if inserting this join record should be subject to xatafae permissions. |
Exception | If it fails to save. |
Definition at line 184 of file XFTranslationMemory.php.
containsTranslation | ( | $ | string, |
$ | translation | ||
) |
Checks if the current translation memory contains the specified translation.
string | $string | The source string |
string | $translation | The translated string. |
Definition at line 315 of file XFTranslationMemory.php.
static findString | ( | $ | string, |
$ | language | ||
) | [static] |
Finds a record encapsulating the given string.
string | $string | The string that we want to find. |
Definition at line 334 of file XFTranslationMemory.php.
findTranslation | ( | $ | string, |
$ | translation | ||
) |
Finds the translation record for the given translation.
string | $string | The source string or the integer string id of the string. |
string | $translation | The translated String |
Definition at line 389 of file XFTranslationMemory.php.
static getDefaultTranslationMemory | ( | $ | source, |
$ | dest, | ||
$ | secure = false |
||
) | [static] |
Gets the default translation memory for the given source and destination languages.
string | $source | The 2-digit language code of the source language. |
string | $dest | The 2-diggit language code of the destination language. |
boolean | $secure | True if inserting a translation memory record should be subject to Xataface permissions. |
Definition at line 98 of file XFTranslationMemory.php.
getDestinationLanguage | ( | ) |
Gets the 2-digit language code of the destination language of this translation memory.
Definition at line 74 of file XFTranslationMemory.php.
getRecord | ( | ) |
Gets the encapsulated xf_tm_translation_memories record.
Definition at line 57 of file XFTranslationMemory.php.
getSourceLanguage | ( | ) |
Gets the 2-digit language code of the source language of this translation memory.
Definition at line 65 of file XFTranslationMemory.php.
getTranslations | ( | array $ | sources, |
$ | minStatus = 3 , |
||
$ | maxStatus = 5 |
||
) |
Gets translated strings corresponding to the given source strings.
array | $sources | Array of source strings. |
int | $minStatus | The minimum status of a translation to return (5=approved, 3=submitted, 1=rejected) |
int | $maxStatus | The maximum status of a translation to return (5=approved, 3=submitted, 1=rejected) |
Definition at line 548 of file XFTranslationMemory.php.
static loadTranslationMemoryById | ( | $ | id | ) | [static] |
Loads a translation memory by its translation_memory_id.
int | $id | The translation_memory_id of the memory to load. |
Definition at line 203 of file XFTranslationMemory.php.
static loadTranslationMemoryFor | ( | Dataface_Record $ | record, |
$ | source, | ||
$ | dest | ||
) | [static] |
Loads the translation memory for a given record.
Dataface_Record | $record | The record for which the translation memory is used. |
string | $source | The 2-digit language code of the source language. |
string | $dest | The 2-digit language code of the destination language. |
Definition at line 218 of file XFTranslationMemory.php.
scoreTranslation | ( | $ | string, |
$ | translation, | ||
$ | score, | ||
$ | username = null , |
||
$ | secure = false |
||
) |
Scores a translation.
string | $string | The source string (or integer string id) |
string | $translation | The translation string (or integer translation id) |
int | $score | The score to be applied to the translation. |
string | $username | The username of the user who is marking it (default is currently logged in user). |
boolean | $secure | True if marking this translation should be subject to Xataface permissions. |
Definition at line 435 of file XFTranslationMemory.php.
setTranslationStatus | ( | $ | string, |
$ | translation, | ||
$ | status, | ||
$ | username = null , |
||
$ | secure = false |
||
) |
Sets the status of a translation. Should be one of.
string | $string | The source string (or int string id). |
string | $translation | The translated string (or int translation id) |
string | $username | The username of the user who is setting this (default to current logged in user. |
boolean | $secure | True if setting the status should be subject to xataface permissions. |
Definition at line 479 of file XFTranslationMemory.php.
const TRANSLATION_APPROVED = 5 |
Definition at line 34 of file XFTranslationMemory.php.
const TRANSLATION_REJECTED = 1 |
Definition at line 30 of file XFTranslationMemory.php.
const TRANSLATION_SUBMITTED = 3 |
Definition at line 32 of file XFTranslationMemory.php.