Page MenuHomePhabricator

Language switching behavior for SVG Translate
Closed, ResolvedPublic5 Story Points

Description

This ticket describes the behaviors when a user decides to switch languages in the 'From'/'To' dropdowns:

Switching the From language:

Switching the To language:

  • The language in the To column can freely change if there are no translations added by the user yet.
  • If a user tries to switch the To column after adding any translations, the added translations get lost. The user gets a confirm box before the language switches: You are trying to change the translation language but you have unsaved translations. Changing the language will result in loss of any added translations. Please upload the translations to Commons or download the translated file before proceeding. Do you wish to continue? a) Change language b) Cancel
    • The popup does not appear in the user has uploaded the file to Commons before trying to switch languages. It only needs to know clean/dirty and not if the content is the same as before.
  • If the selected To language already has translations in the SVG, the inputs get populated with those translations.

Event Timeline

Niharika triaged this task as Medium priority.Oct 16 2018, 6:17 PM
Niharika created this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 16 2018, 6:17 PM
Niharika assigned this task to Prtksxna.Oct 16 2018, 6:35 PM
Niharika updated the task description. (Show Details)
Niharika added a project: Community-Tech.
Niharika moved this task from Untriaged to In Design on the Community-Tech board.

@Prtksxna Flagging this for you, Prateek. If you don't have any questions/suggestions, please unassign yourself and place this in the Estimation column. Thank you.

Prtksxna updated the task description. (Show Details)Oct 20 2018, 5:26 AM

@Niharika would this ticket include the fact that the To list needs to show different sections for:

  • Preferred languages
  • Existing translations languages
  • Other languages

Or would that be the scope of another ticket?

My suspicion is that this will take a bit of creative cheating as well as a storage method (cookie or local Storage), so I'd say let's split that part up to another ticket. This one can deal only with implementing uls and having it apply the chosen language.

The second ticket can deal with storage in cookies, marking languages as existing in the ULS dialog, etc.

Prtksxna removed Prtksxna as the assignee of this task.Oct 22 2018, 5:10 AM
Prtksxna updated the task description. (Show Details)
Prtksxna added a subscriber: Prtksxna.

Got it, a separate ticket is a good idea. I've removed the following from the description:

  • If the user has not selected any Preferred language in their settings, then the languages chosen here should automatically be saved as the preferred (they can always change it later from the settings dialog).

@Niharika would this ticket include the fact that the To list needs to show different sections for:

  • Preferred languages
  • Existing translations languages
  • Other languages

Or would that be the scope of another ticket?

Another ticket. T207711: SVG Parsing I - Language dropdowns in SVG Translate tool. I don't think it's a good idea to make "Preferred languages" and "Existing translations languages" as two different sections as they are not mutually exclusive. Someone's preferred language may or may not already have translations. I propose having a section for "Preferred languages" on top and all other below it. For languages that do have an existing translation, I think we can display an indicator next to the image name to depict that it already has a translation. Users will understand what that means after they use it once. ULS already supports that to some extent:

Holding off on estimating this until estimation on Oct 30.

aezell updated the task description. (Show Details)Nov 7 2018, 12:21 AM
Niharika set the point value for this task to 5.Nov 7 2018, 12:25 AM
Niharika moved this task from To be estimated/discussed to Estimated on the Community-Tech board.
Samwilson updated the task description. (Show Details)Dec 19 2018, 12:51 AM
Samwilson updated the task description. (Show Details)
Samwilson claimed this task.Jan 9 2019, 8:01 PM
Samwilson moved this task from Ready to In Development on the Community-Tech-Sprint board.

Where this ticket is up to...

  • The image labels change to be in the new From language - only the ones which are not translated yet.
  • If the selected To language already has translations in the SVG, the inputs get populated with those translations.

These features are already done, merged, and ready for QA.

  • The language in the To column can freely change if there are no translations added by the user yet.
  • If a user tries to switch the To column after adding any translations, the added translations get lost. The user gets a confirm box before the language switches.

This is https://github.com/wikimedia/svgtranslate/pull/51 and it's not yet ready for code review.

  • The popup does not appear in the user has uploaded the file to Commons before trying to switch languages. It only needs to know clean/dirty and not if the content is the same as before.

I'm probably not thinking clearly about this, but it seems to me that this is going to happen without any special action on our part: if the user has entered text (i.e. the form is unsaved) and then clicks one of the buttons, the whole page will reload and they'll be sent back to the same To and From languages and if at that point they switch the To language they'll not get a confirmation because the whole form is in an untouched state. Which is good. :) And the other bits of that happening (the submission and redirect) are all handled in separate tickets aren't they?

That makes sense, @Samwilson.
Yep, the submission and redirect will be handled in the upload image ticket.

Patch merged; staging site updated; ready for QA.

I've just found a regression with this: the from-language is not switching properly. Will investigate.

Niharika added a comment.EditedFeb 11 2019, 6:57 PM

@Samwilson I still see the broken language switching in production. I can't switch the From language.

Uncaught TypeError: Cannot read property 'fa' of undefined
    at HTMLDivElement.<anonymous> (app.10e4979a.js:65)
    at Function.each (app.10e4979a.js:39)
    at E.fn.init.each (app.10e4979a.js:39)
    at app.10e4979a.js:65
    at t.ui.DropdownInputWidget.i.EventEmitter.emit (app.10e4979a.js:158)
    at t.ui.DropdownInputWidget.t.ui.InputWidget.setValue (app.10e4979a.js:85)
    at t.ui.DropdownInputWidget.setValue (app.10e4979a.js:85)
    at t.ui.DropdownInputWidget.onMenuSelect (app.10e4979a.js:85)
    at t.ui.MenuSelectWidget.i.EventEmitter.emit (app.10e4979a.js:158)
    at t.ui.MenuSelectWidget.t.ui.SelectWidget.selectItem (app.10e4979a.js:85)

Production hasn't been updated with this yet. I forgot to move this to QA when the patch was merged. Doing so now. Test with e.g. https://tools.wmflabs.org/svgtranslate-test/File:Speech_bubbles.svg

Niharika added a comment.EditedFeb 12 2019, 7:38 PM

@Samwilson Works for me! Please update production too. If you can tell me what are the steps to update production, I can do it myself without bothering you over it.

Prod updated.

Once https://github.com/wikimedia/ToolforgeBundle/pull/12 is resolved, both staging and production will update themselves to master or the latest tag, so this will all be easier.

This is ready for QA.

Works for me now. I just realized I never updated this task after we changed our preview plans at the offsite meeting. I'll update the task.

Niharika closed this task as Resolved.Feb 25 2019, 6:29 PM
Niharika updated the task description. (Show Details)
Niharika moved this task from QA to Q3 2018-19 on the Community-Tech-Sprint board.
Niharika moved this task from In progress to Done on the SVG Translate Tool board.