Page MenuHomePhabricator

Create an API for the JavaScript to read the available translations in the SVG (and send the new translations in so the backend creates a new SVG)
Closed, ResolvedPublic8 Story Points


After we have the basic function in T206721: Create the code to process SVG file to workable data and back into SVG file, we should also have a way for the interface JS to read and accept available translations, as well as send the new translations in so the system can create a new SVG.

We might need this mid-translation so we can do a "preview" (the JS will send an AJAX request to the server to get the new SVG based on the translations currently in memory).

Open questions:

  • What is the best structure to hand off to the JS? JSON blob that includes what data?
  • Should we always send the entire structure of the image to the JS so it's all in memory, or should we request per-language data when requested. This means that if a user initially starts with language X and then switches to language Y to translate -- would the information already by in memory in JS (quick switch) or would we need to send a request to the server, get the data, and load existing translations (or empty if they don't exist) into the interface.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 11 2018, 12:16 AM

Proposed API modules:

The API should have two end-points:

  1. A request to receive a full SVG image (XML structure) -- this will be used for the front end preview option, and for setting things up for upload. This endpoint will receive a request with languages and their translation, and output a full SVG file.
  2. A request to receive the list of existing languages and translations on the existing file -- this will be used to display existing translations in the UI and the preview.

As for the second question -- We can start with receiving all available languages and storing that in memory, and, if needed, in the future, expand to have the module (#2) get specific language (or set of languages) if adding a parameter to the request. The module can be expanded to use specifics later, so we can start with the straight forward solution first, which gives us all available translations in the JSON response.

Niharika set the point value for this task to 8.Oct 23 2018, 11:17 PM
Niharika added a subscriber: Niharika.

Meeting discussion:

  • Need to cache the image - Sam/Moriel to create a task about that
    • Don't need to fetch image every time from Commons (repeated requests + problems when SVG on commons changes)
  • API needs to have error responses when it cannot complete the request
MaxSem claimed this task.Oct 23 2018, 11:41 PM

@Mooeypoo Can you sign off on this ticket?

Yes, this is done. We're continuously adding some methods to the API, but we should create new tickets as they come.

Mooeypoo closed this task as Resolved.Nov 29 2018, 11:30 PM