Extension:LocalisationUpdate/LUv2/Notes

Getting notifications from TWN to LUv2 service
There are two main jobs of the service. First, keeping track of the translations on twn. This is to be handled by a callback url that'll be provided by the service. Second, pushing the updates to subscribers.

For the first part we have primarily two options.

Notifications via TWN (Translate)
To get notifications directly from Translate we can have a hook that would send a POST request to service's callback URL. The hook will run when admins on TWN approve updates. The request body will contain following parameters.


 * hub.project : The project identifier.
 * hub.language : Language affected in last update.


 * Pros
 * We can have realtime updates.


 * Cons
 * This might require (major?) changes in regards to how reviewing works in Translate. We don't want to have individual updates for each approval. So if we're to go forward with this option we'd need to store the reviewed messages in a session and when reviewing is done the admin can submit all of them at once.

Notifications via git hooks
Nothing fancy. We'd setup a git hook in every project repository. The hook would check if any localisation files were updated. It'd fetch the list of files chaged after the last update. This can be done with this one-liner:

git diff-tree --no-commit-id --name-only -r SHA1 SHA2

Where, SHA1 would be the hash of the latest commit at the time of last update, SHA2 is HEAD. Then the script will parse the list returned by this and figure out the languages in which translations were updated. Then it'd make the request with the request body with the same parameters as described in the first option.


 * Pros
 * Relatively simple and quick to implement.


 * Cons
 * Maintaining could be a pain. We'd have to setup hooks for every repository. (What's the number of actively translated mw extensions on TWN, by the way?)
 * No realtime updates.