Page MenuHomePhabricator

Missing i18n in JS: edit summaries for editing annotations
Open, NormalPublic

Description

JS code hardcodes the edit summaries for editing annotations (passed as parameters for #saveAnnotations) in English.

The hard part here is getting them to be in content language – ResourceLoader doesn't currently support that. We'd have to wait for T27349 or implement a subclass of ResourceLoaderFileModule that would handle it (example: MobileFrontend's MFResourceLoaderParsedMessageModule).

Event Timeline

matmarex created this task.Sep 12 2016, 8:43 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptSep 12 2016, 8:43 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Restricted Application added a subscriber: Matanya. · View Herald TranscriptSep 13 2016, 10:03 AM

For now I propose leaving it as-is, we can push this once we need to (I think a beta cluster deploy can live in this state for now)

or implement a subclass of ResourceLoaderFileModule that would handle it (example: MobileFrontend's MFResourceLoaderParsedMessageModule).

For the interim I'd recommend going with a data module. This is an established, stable and supported pattern. (Either as plain class like VisualEditorDataModule, or as FileModule subclass if you only ever need it within one module; to reduce module noise).

ResourceLoader recently gained a $context->msg() method, for use as $context->msg() or $context->msg()->inContentLanguage() inside getScript. Together with enableModuleContentVersion() this should make for a simple and low-maintenance module.

The only catch is that you need to enumerate the keys inside the PHP class rather than conveniently listing them inside extension.json (though I suppose you could make it a constructor option actually, it's a fresh class after all). You'll need a JS identifier to stash them in, either specific to the extension or a good ol' mw.config key (don't use mw.messages).

MarkTraceur triaged this task as Low priority.Nov 30 2016, 6:50 PM
MarkTraceur moved this task from Untriaged to Next up on the Multimedia board.
MarkTraceur raised the priority of this task from Low to Normal.Sep 11 2017, 4:26 PM
MarkTraceur moved this task from Next up to Triaged on the Multimedia board.