Class is use to track the changes made when importing messages from the remote sources using processMessageChanges. More...
Public Member Functions | |
__construct ( $changes=[]) | |
addChange ( $language, $key, $content) | |
Add a change under a message group for a specific language. | |
addAddition ( $language, $key, $content) | |
Add an addition under a message group for a specific language. | |
addDeletion ( $language, $key, $content) | |
Adds a deletion under a message group for a specific language. | |
addRename ( $language, $addedMessage, $deletedMessage, $similarity=0) | |
Adds a rename under a message group for a specific language. | |
setRenameState ( $language, $msgKey, $state) | |
getChanges ( $language) | |
Fetch changes for a message group under a language. | |
getDeletions ( $language) | |
Fetch deletions for a message group under a language. | |
getAdditions ( $language) | |
Fetch additions for a message group under a language. | |
findMessage ( $language, $key, $possibleStates=[], &$modificationType=null) | |
Finds a message with the given key across different types of modifications. | |
breakRename ( $languageCode, $msgKey) | |
Break renames, and put messages back into their previous state. | |
getRenames ( $language) | |
Fetch renames for a message group under a language. | |
removeAdditions ( $language, $keysToRemove) | |
Remove additions for a language under the group. | |
removeDeletions ( $language, $keysToRemove) | |
Remove deletions for a language under the group. | |
removeChanges ( $language, $keysToRemove) | |
Remove changes for a language under the group. | |
removeRenames ( $language, $keysToRemove) | |
Remove renames for a language under the group. | |
removeBasedOnType ( $language, $keysToRemove, $type) | |
Remove modifications based on the type. | |
removeChangesForLanguage ( $language) | |
Remove all language related changes for a group. | |
getAllModifications () | |
Return all modifications for the group. | |
getModificationsForLanguage ( $language) | |
Get all for a language under the group. | |
getLanguages () | |
Get all language keys with modifications under the group. | |
hasOnly ( $language, $type) | |
Determines if the group has only a certain type of change under a language. | |
isPreviousState ( $languageCode, $key, array $types) | |
Checks if the previous state of a renamed message matches a given value. | |
getMatchedMessage ( $languageCode, $key) | |
Get matched rename message for a given key. | |
getMatchedKey ( $languageCode, $key) | |
Get matched rename key for a given key. | |
getSimilarity ( $languageCode, $key) | |
Returns the calculated similarity for a rename. | |
isEqual ( $languageCode, $key) | |
Checks if a given key is equal to matched rename message. | |
isSimilar ( $languageCode, $key) | |
Checks if a given key is similar to matched rename message. | |
areStringsSimilar ( $similarity) | |
Checks if the similarity percent passed passes the min threshold. | |
areStringsEqual ( $similarity) | |
Checks if the similarity percent passed. | |
Static Public Member Functions | |
static | loadModifications ( $changesData) |
Loads the changes, and returns an instance of the class. | |
Public Attributes | |
const | ADDITION = 'addition' |
const | CHANGE = 'change' |
const | DELETION = 'deletion' |
const | RENAME = 'rename' |
const | NONE = 'none' |
Protected Member Functions | |
addModification ( $language, $type, $key, $content) | |
getModification ( $language, $type) | |
removeModification ( $language, $type, $keysToRemove=null) | |
Protected Attributes | |
$changes = [] | |
$addFunctionMap | |
$removeFunctionMap | |
Class is use to track the changes made when importing messages from the remote sources using processMessageChanges.
Also provides an interface to query these changes, and update them.
Definition at line 19 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::__construct | ( | $changes = [] | ) |
array[][][] | $changes |
Definition at line 46 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::addAddition | ( | $language, | |
$key, | |||
$content ) |
Add an addition under a message group for a specific language.
string | $language | |
string | $key | |
string | $content |
Definition at line 77 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::addChange | ( | $language, | |
$key, | |||
$content ) |
Add a change under a message group for a specific language.
string | $language | |
string | $key | |
string | $content |
Definition at line 67 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::addDeletion | ( | $language, | |
$key, | |||
$content ) |
Adds a deletion under a message group for a specific language.
string | $language | |
string | $key | |
string | $content |
Definition at line 87 of file MessageSourceChange.php.
|
protected |
string | $language | |
string | $type | |
string | $key | |
string | $content |
Definition at line 141 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::addRename | ( | $language, | |
$addedMessage, | |||
$deletedMessage, | |||
$similarity = 0 ) |
Adds a rename under a message group for a specific language.
string | $language | |
string[] | $addedMessage | |
string[] | $deletedMessage | |
float | $similarity |
Definition at line 98 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::areStringsEqual | ( | $similarity | ) |
Checks if the similarity percent passed.
float | $similarity |
Definition at line 550 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::areStringsSimilar | ( | $similarity | ) |
Checks if the similarity percent passed passes the min threshold.
float | $similarity |
Definition at line 541 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::breakRename | ( | $languageCode, | |
$msgKey ) |
Break renames, and put messages back into their previous state.
string | $languageCode | |
string | $msgKey |
Definition at line 226 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::findMessage | ( | $language, | |
$key, | |||
$possibleStates = [], | |||
& | $modificationType = null ) |
Finds a message with the given key across different types of modifications.
string | $language | |
string | $key | |
string[] | $possibleStates | |
string | null | &$modificationType |
Definition at line 183 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getAdditions | ( | $language | ) |
Fetch additions for a message group under a language.
string | $language |
Definition at line 171 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getAllModifications | ( | ) |
Return all modifications for the group.
Definition at line 387 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getChanges | ( | $language | ) |
Fetch changes for a message group under a language.
string | $language |
Definition at line 153 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getDeletions | ( | $language | ) |
Fetch deletions for a message group under a language.
string | $language |
Definition at line 162 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getLanguages | ( | ) |
Get all language keys with modifications under the group.
Definition at line 413 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getMatchedKey | ( | $languageCode, | |
$key ) |
Get matched rename key for a given key.
string | $languageCode | |
string | $key |
Definition at line 497 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getMatchedMessage | ( | $languageCode, | |
$key ) |
Get matched rename message for a given key.
string | $languageCode | |
string | $key |
Definition at line 482 of file MessageSourceChange.php.
|
protected |
string | $language | |
string | $type |
Definition at line 289 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getModificationsForLanguage | ( | $language | ) |
Get all for a language under the group.
string | $language |
Definition at line 396 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getRenames | ( | $language | ) |
Fetch renames for a message group under a language.
string | $language |
Definition at line 275 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::getSimilarity | ( | $languageCode, | |
$key ) |
Returns the calculated similarity for a rename.
string | $languageCode | |
string | $key |
Definition at line 507 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::hasOnly | ( | $language, | |
$type ) |
Determines if the group has only a certain type of change under a language.
string | $language | |
string | $type |
Definition at line 424 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::isEqual | ( | $languageCode, | |
$key ) |
Checks if a given key is equal to matched rename message.
string | $languageCode | |
string | $key |
Definition at line 519 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::isPreviousState | ( | $languageCode, | |
$key, | |||
array | $types ) |
Checks if the previous state of a renamed message matches a given value.
string | $languageCode | |
string | $key | |
string[] | $types |
Definition at line 470 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::isSimilar | ( | $languageCode, | |
$key ) |
Checks if a given key is similar to matched rename message.
string | $languageCode | |
string | $key |
Definition at line 531 of file MessageSourceChange.php.
|
static |
Loads the changes, and returns an instance of the class.
array | $changesData |
Definition at line 405 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::removeAdditions | ( | $language, | |
$keysToRemove ) |
Remove additions for a language under the group.
string | $language | |
array | null | $keysToRemove |
Definition at line 298 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::removeBasedOnType | ( | $language, | |
$keysToRemove, | |||
$type ) |
Remove modifications based on the type.
Avoids usage of ugly if / switch statement.
string | $language | |
array | $keysToRemove | |
string | $type | One of ADDITION, CHANGE, DELETION |
Definition at line 336 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::removeChanges | ( | $language, | |
$keysToRemove ) |
Remove changes for a language under the group.
string | $language | |
array | null | $keysToRemove |
Definition at line 316 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::removeChangesForLanguage | ( | $language | ) |
Remove all language related changes for a group.
string | $language |
Definition at line 353 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::removeDeletions | ( | $language, | |
$keysToRemove ) |
Remove deletions for a language under the group.
string | $language | |
array | null | $keysToRemove |
Definition at line 307 of file MessageSourceChange.php.
|
protected |
Definition at line 357 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::removeRenames | ( | $language, | |
$keysToRemove ) |
Remove renames for a language under the group.
string | $language | |
array | null | $keysToRemove |
Definition at line 325 of file MessageSourceChange.php.
MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::setRenameState | ( | $language, | |
$msgKey, | |||
$state ) |
Definition at line 116 of file MessageSourceChange.php.
|
protected |
Definition at line 38 of file MessageSourceChange.php.
|
protected |
Definition at line 25 of file MessageSourceChange.php.
|
protected |
Definition at line 43 of file MessageSourceChange.php.
const MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::ADDITION = 'addition' |
Definition at line 26 of file MessageSourceChange.php.
const MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::CHANGE = 'change' |
Definition at line 27 of file MessageSourceChange.php.
const MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::DELETION = 'deletion' |
Definition at line 28 of file MessageSourceChange.php.
const MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::NONE = 'none' |
Definition at line 30 of file MessageSourceChange.php.
const MediaWiki\Extension\Translate\MessageSync\MessageSourceChange::RENAME = 'rename' |
Definition at line 29 of file MessageSourceChange.php.