Provides the nice boxes that aid the translators to do their job. More...
Public Member Functions | |
__construct (Title $title, $groupId) | |
getTextareaId () | |
Gets the HTML id of the text area that contains the translation. | |
setTextareaId ($id) | |
Sets the HTML id of the text area that contains the translation. | |
setEditMode ($mode=true) | |
Enable or disable extra help for editing. | |
getDefinition () | |
Gets the message definition. | |
getTranslation () | |
Gets the current message translation. | |
setTranslation ($translation) | |
Manual override for the translation. | |
getTargetLanguage () | |
Gets the linguistically correct language code for translation. | |
getBoxes ($suggestions= 'sync') | |
Returns block element HTML snippet that contains the translation aids. | |
callBox ($type, $cb, $params=array()) | |
Public since 2012-06-26. | |
getBoxNames () | |
getSuggestionBox () | |
getDefinitionBox () | |
getTranslationDisplayBox () | |
getCheckBox () | |
getOtherLanguagesBox () | |
getSeparatorBox () | |
getDocumentationBox () | |
getLazySuggestionBox () | |
dialogID () | |
adder ($source, $lang) | |
wrapInsert ($id, $text) | |
suggestionField ($text) | |
Static Public Member Functions | |
static | ajaxEditLink ($target, $text) |
Ajax-enabled message editing link. | |
static | jQueryPathId ($id) |
Escapes $id such that it can be used in jQuery selector. | |
static | checkTranslationServiceFailure ($service) |
Checks whether the given service has exceeded failure count. | |
static | reportTranslationServiceFailure ($service) |
Increases the failure count for a given service. | |
static | addModules (OutputPage $out) |
Protected Member Functions | |
getMessageGroup (MessageHandle $handle, $groupId) | |
Tries to determine to which group this message belongs. | |
getTTMServerBox ($serviceName, $config) | |
Returns suggestions from a translation memory. | |
getRemoteTTMServerBox ($serviceName, $config) | |
Returns suggestions from a translation memory. | |
formatTTMServerSuggestions ($data) | |
Since 2012-03-05. | |
getMicrosoftSuggestion ($serviceName, $config) | |
getApertiumSuggestion ($serviceName, $config) | |
getYandexSuggestion ($serviceName, $config) | |
formatGettextComments () | |
getPageDiff () | |
getLastDiff () | |
mustBeKnownMessage () | |
mustBeTranslation () | |
mustHaveDefinition () | |
Static Protected Member Functions | |
static | makeGoogleQueryParams ($definition, $pair, $config) |
static | wrapUntranslatable ($text) |
static | unwrapUntranslatable ($text) |
static | legend ($label) |
static | clear () |
static | getFallbacks ($code) |
Protected Attributes | |
$handle | |
$group | |
$translation | |
The current translation as a string. | |
$definition | |
The message definition as a string. | |
$textareaId = 'wpTextbox1' | |
HTML id to the text area that contains the translation. | |
$editMode = 'true' | |
Whether to include extra tools to aid translating. | |
Static Protected Attributes | |
static | $serviceFailureCount = 5 |
How many failures during failure period need to happen to consider the service being temporarily off-line. | |
static | $serviceFailurePeriod = 900 |
How long after the last detected failure we clear the status and try again. |
Provides the nice boxes that aid the translators to do their job.
Boxes contain definition, documentation, other languages, translation memory suggestions, highlighted changes etc.
Definition at line 17 of file TranslationHelpers.php.
TranslationHelpers::__construct | ( | Title $ | title, | |
$ | groupId | |||
) |
Title | $title Title of a page that holds a translation. | |
string | $groupId Group id that should be used, otherwise autodetected from title. |
Definition at line 51 of file TranslationHelpers.php.
TranslationHelpers::adder | ( | $ | source, | |
$ | lang | |||
) |
string | $source jQuery selector for element containing the source | |
string|Language | $lang Language code or object |
Definition at line 1272 of file TranslationHelpers.php.
Referenced by getDefinitionBox(), getOtherLanguagesBox(), and suggestionField().
static TranslationHelpers::addModules | ( | OutputPage $ | out | ) | [static] |
Definition at line 1418 of file TranslationHelpers.php.
Referenced by TranslateEditAddons::displayOnDiff(), TranslateEditAddons::editBoxes(), MessageTable::includeAssets(), and SpecialTranslations::includeAssets().
static TranslationHelpers::ajaxEditLink | ( | $ | target, | |
$ | text | |||
) | [static] |
Ajax-enabled message editing link.
$target | Title: Title of the target message. | |
$text | String: Link text for Linker::link() |
Definition at line 1324 of file TranslationHelpers.php.
Referenced by formatTTMServerSuggestions(), getDocumentationBox(), getOtherLanguagesBox(), and SpecialTranslations::showTranslations().
TranslationHelpers::callBox | ( | $ | type, | |
$ | cb, | |||
$ | params = array() | |||
) |
Public since 2012-06-26.
Definition at line 225 of file TranslationHelpers.php.
Referenced by getBoxes().
static TranslationHelpers::checkTranslationServiceFailure | ( | $ | service | ) | [static] |
Checks whether the given service has exceeded failure count.
$service | string |
TranslationHelperException |
Definition at line 1363 of file TranslationHelpers.php.
Referenced by getApertiumSuggestion(), getMicrosoftSuggestion(), getRemoteTTMServerBox(), and getYandexSuggestion().
static TranslationHelpers::clear | ( | ) | [static, protected] |
Definition at line 1195 of file TranslationHelpers.php.
Referenced by getOtherLanguagesBox().
TranslationHelpers::dialogID | ( | ) |
Definition at line 1261 of file TranslationHelpers.php.
Referenced by getDefinitionBox(), getLazySuggestionBox(), getOtherLanguagesBox(), and suggestionField().
TranslationHelpers::formatGettextComments | ( | ) | [protected] |
Definition at line 1022 of file TranslationHelpers.php.
Referenced by getDocumentationBox().
TranslationHelpers::formatTTMServerSuggestions | ( | $ | data | ) | [protected] |
Since 2012-03-05.
Definition at line 325 of file TranslationHelpers.php.
Referenced by getSuggestionBox().
TranslationHelpers::getApertiumSuggestion | ( | $ | serviceName, | |
$ | config | |||
) | [protected] |
TranslationHelpers::getBoxes | ( | $ | suggestions = 'sync' |
) |
Returns block element HTML snippet that contains the translation aids.
Not all boxes are shown all the time depending on whether they have any information to show and on configuration variables.
$suggestions | string |
Definition at line 177 of file TranslationHelpers.php.
TranslationHelpers::getBoxNames | ( | ) |
TranslationHelpers::getCheckBox | ( | ) |
TranslationHelpers::getDefinition | ( | ) |
Gets the message definition.
Definition at line 105 of file TranslationHelpers.php.
Referenced by getCheckBox(), getDefinitionBox(), getMicrosoftSuggestion(), getRemoteTTMServerBox(), getTTMServerBox(), and mustHaveDefinition().
TranslationHelpers::getDefinitionBox | ( | ) |
TranslationHelpers::getDocumentationBox | ( | ) |
static TranslationHelpers::getFallbacks | ( | $ | code | ) | [static, protected] |
TranslationHelpers::getLastDiff | ( | ) | [protected] |
TranslationHelpers::getLazySuggestionBox | ( | ) |
Definition at line 1236 of file TranslationHelpers.php.
TranslationHelpers::getMessageGroup | ( | MessageHandle $ | handle, | |
$ | groupId | |||
) | [protected] |
Tries to determine to which group this message belongs.
It tries to get group id from loadgroup GET-paramater, but fallbacks to messageIndex file if no valid group was provided.
MessageHandle | $handle | |
string | $groupId |
Definition at line 65 of file TranslationHelpers.php.
Referenced by __construct().
TranslationHelpers::getMicrosoftSuggestion | ( | $ | serviceName, | |
$ | config | |||
) | [protected] |
TranslationHelpers::getOtherLanguagesBox | ( | ) |
TranslationHelpers::getPageDiff | ( | ) | [protected] |
TranslationHelpers::getRemoteTTMServerBox | ( | $ | serviceName, | |
$ | config | |||
) | [protected] |
Returns suggestions from a translation memory.
$serviceName | ||
$config |
TranslationHelperException |
Definition at line 278 of file TranslationHelpers.php.
TranslationHelpers::getSeparatorBox | ( | ) |
Definition at line 970 of file TranslationHelpers.php.
TranslationHelpers::getSuggestionBox | ( | ) |
MWException |
Definition at line 405 of file TranslationHelpers.php.
TranslationHelpers::getTargetLanguage | ( | ) |
Gets the linguistically correct language code for translation.
Definition at line 155 of file TranslationHelpers.php.
Referenced by getLastDiff(), and suggestionField().
TranslationHelpers::getTextareaId | ( | ) |
Gets the HTML id of the text area that contains the translation.
Definition at line 81 of file TranslationHelpers.php.
Referenced by adder().
TranslationHelpers::getTranslation | ( | ) |
Gets the current message translation.
Fuzzy messages will be marked as such unless translation is provided manually.
Definition at line 129 of file TranslationHelpers.php.
Referenced by getCheckBox(), and getTranslationDisplayBox().
TranslationHelpers::getTranslationDisplayBox | ( | ) |
TranslationHelpers::getTTMServerBox | ( | $ | serviceName, | |
$ | config | |||
) | [protected] |
Returns suggestions from a translation memory.
$serviceName | ||
$config |
TranslationHelperException |
Definition at line 255 of file TranslationHelpers.php.
TranslationHelpers::getYandexSuggestion | ( | $ | serviceName, | |
$ | config | |||
) | [protected] |
static TranslationHelpers::jQueryPathId | ( | $ | id | ) | [static] |
Escapes $id such that it can be used in jQuery selector.
$id | string |
Definition at line 1342 of file TranslationHelpers.php.
Referenced by adder(), and getLazySuggestionBox().
static TranslationHelpers::legend | ( | $ | label | ) | [static, protected] |
$label | string |
Definition at line 1187 of file TranslationHelpers.php.
Referenced by getOtherLanguagesBox().
static TranslationHelpers::makeGoogleQueryParams | ( | $ | definition, | |
$ | pair, | |||
$ | config | |||
) | [static, protected] |
Definition at line 478 of file TranslationHelpers.php.
Referenced by getApertiumSuggestion().
TranslationHelpers::mustBeKnownMessage | ( | ) | [protected] |
Definition at line 1430 of file TranslationHelpers.php.
Referenced by getCheckBox(), getDefinition(), getLazySuggestionBox(), getPageDiff(), and getTargetLanguage().
TranslationHelpers::mustBeTranslation | ( | ) | [protected] |
Definition at line 1437 of file TranslationHelpers.php.
Referenced by getRemoteTTMServerBox(), and getTTMServerBox().
TranslationHelpers::mustHaveDefinition | ( | ) | [protected] |
Definition at line 1444 of file TranslationHelpers.php.
Referenced by getDefinitionBox(), getMicrosoftSuggestion(), getRemoteTTMServerBox(), and getTTMServerBox().
static TranslationHelpers::reportTranslationServiceFailure | ( | $ | service | ) | [static] |
Increases the failure count for a given service.
$service |
TranslationHelperException |
Definition at line 1396 of file TranslationHelpers.php.
Referenced by getApertiumSuggestion(), getMicrosoftSuggestion(), getRemoteTTMServerBox(), and getYandexSuggestion().
TranslationHelpers::setEditMode | ( | $ | mode = true |
) |
Enable or disable extra help for editing.
$mode | Boolean |
Definition at line 97 of file TranslationHelpers.php.
TranslationHelpers::setTextareaId | ( | $ | id | ) |
Sets the HTML id of the text area that contains the translation.
$id | String |
Definition at line 89 of file TranslationHelpers.php.
TranslationHelpers::setTranslation | ( | $ | translation | ) |
Manual override for the translation.
If not given or it is null, the code will try to fetch it automatically.
string|null | $translation |
Definition at line 148 of file TranslationHelpers.php.
TranslationHelpers::suggestionField | ( | $ | text | ) |
$text | string |
Definition at line 1302 of file TranslationHelpers.php.
Referenced by formatTTMServerSuggestions(), getApertiumSuggestion(), getMicrosoftSuggestion(), and getYandexSuggestion().
static TranslationHelpers::unwrapUntranslatable | ( | $ | text | ) | [static, protected] |
Definition at line 577 of file TranslationHelpers.php.
Referenced by getMicrosoftSuggestion().
TranslationHelpers::wrapInsert | ( | $ | id, | |
$ | text | |||
) |
$id | string|int | |
$text | string |
Definition at line 1294 of file TranslationHelpers.php.
Referenced by getDefinitionBox(), getOtherLanguagesBox(), and suggestionField().
static TranslationHelpers::wrapUntranslatable | ( | $ | text | ) | [static, protected] |
Definition at line 568 of file TranslationHelpers.php.
Referenced by getMicrosoftSuggestion().
TranslationHelpers::$definition [protected] |
The message definition as a string.
Definition at line 36 of file TranslationHelpers.php.
Referenced by getMicrosoftSuggestion(), getRemoteTTMServerBox(), getTTMServerBox(), and makeGoogleQueryParams().
TranslationHelpers::$editMode = 'true' [protected] |
Whether to include extra tools to aid translating.
Definition at line 45 of file TranslationHelpers.php.
TranslationHelpers::$group [protected] |
Definition at line 27 of file TranslationHelpers.php.
Referenced by formatGettextComments().
TranslationHelpers::$handle [protected] |
Definition at line 22 of file TranslationHelpers.php.
Referenced by ajaxEditLink().
TranslationHelpers::$serviceFailureCount = 5 [static, protected] |
How many failures during failure period need to happen to consider the service being temporarily off-line.
Definition at line 1351 of file TranslationHelpers.php.
TranslationHelpers::$serviceFailurePeriod = 900 [static, protected] |
How long after the last detected failure we clear the status and try again.
Definition at line 1356 of file TranslationHelpers.php.
TranslationHelpers::$textareaId = 'wpTextbox1' [protected] |
HTML id to the text area that contains the translation.
Used to insert suggestion directly into the text area, for example.
Definition at line 41 of file TranslationHelpers.php.
TranslationHelpers::$translation [protected] |
The current translation as a string.
Definition at line 32 of file TranslationHelpers.php.
Referenced by getCheckBox(), and setTranslation().