Page MenuHomePhabricator

Translatable modules: Add ability to provide a description for MessageBundle message groups
Closed, ResolvedPublic4 Estimated Story Points

Description

Currently the description of a MessageBundle is hard coded and fetched from JSON localisation files. Instead add a string in @metadata that allows dynamic description for MessageBundle message group.

{
  "@metadata": {
    "sourceLanguage": "fr",
    "priorityLanguages": [],
    "allowOnlyPriorityLanguages": true,
    "description": "Description for the component"
  },
  "T1": "This is the string to be translated in the text unit T1",
  "T2": "This is the string to be translated in the text unit T2"
}

We would have to see how to make this text translatable into different languages

Event Timeline

abi_ triaged this task as Medium priority.Jul 5 2022, 4:50 AM
abi_ set the point value for this task to 4.

I looked at how this functionality has been implemented for WikiPageMessageGroup. We allow for adding a custom group description by using: MediaWiki:Tp-custom-<group ID>.

For MessageBundleMessageGroup the description will be initially provided via the @metadata section in the JSON under a description key.

I see two approaches to handling the description:

  1. Store the description in the translate_metadata table, and load and display the description from there. The drawback with this approach is that the description cannot be translated or edited without editing the message bundle.
  2. Store the description in a separate page like we do for the WikiPageMessageGroup. This page could be marked for translations, and users can edit it without editing the message bundle. The challenge would be keeping this description in the separate page, and description property in the JSON in sync.

I'll go ahead with the second approach for now without worrying about the syncing.

Change 811878 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] Add feature to save description for a message bundle

https://gerrit.wikimedia.org/r/811878

Change 811878 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Add feature to save description for a message bundle

https://gerrit.wikimedia.org/r/811878

Tested on Translatewiki:

image.png (450×924 px, 46 KB)