Page MenuHomePhabricator

Improve the process for initializing a message bundle
Open, Needs TriagePublicFeature

Description

From my experience with testing Message bundles, one of the biggest inconveniences was creating the bundle page, setting its content model, and naming it.

The content model has to be "Translatable message bundle". As far as I can see, there is no way to create a page that has this content model by default. Any page that is created as wikitext can be changed to "Translatable message bundle", although if the page is blank or if the JSON syntax is invalid, changing the content model will fail with the error "Invalid message bundle: Error while parsing the JSON: Syntax error". It's good that this validation exists, but it would be even better if editors could create it as JSON from the start and then use the JSON editor's own validation.

Furthermore, there is the issue of naming the page. The best naming practice I can think of at the moment, with the current configuration, is to put the message bundle in the Module namespace and to append a standardized suffix. I've been using "/i18n" till now, but it can be something else. However, if a page is created in the Module namespace, its initial content model is "Scribunto module", so the page cannot even be published because valid JSON is not valid Lua, and the Lua editor doesn't allow publishing pages with Lua syntax errors.

The workaround I've been using till now is to create the page in my user space, change its content model, and then move it to the Module namespace. This workaround is quite cumbersome, however,

The solutions I can think of are:

  1. Automatically set the "Translatable message bundle" content model on new pages in the Module namespace if they have a certain suffix (can be "/i18n" or something else).
  2. Create a new namespace for message bundles and set new pages in it to "Translatable message bundle" by default.

I'm open to other suggestions.

Event Timeline

You can go to Special:ChangeContentModel and enter a nonexistent page, and then specify the Message Bundle content model to create it directly. Well, at least, you should be able to.

It should be relatively easy to setup a hook or something to define a default content model for pages matching a certain pattern. We didn't want to enforce it up front before we get feedback.

My preference would be to keep the message bundles together with the modules rather than spread out to different namespaces.

You can go to Special:ChangeContentModel and enter a nonexistent page, and then specify the Message Bundle content model to create it directly. Well, at least, you should be able to.

Apparently, it is, but it's kind of weird.

I'd really prefer this to be done automatically and trust the wiki community not to abuse it. And I cannot even think of ways to abuse it, but perhaps I'm naïve because I'm a localization person and not a security person.

The problem with automation is that it makes the opposite difficult: putting Lua code on an /i18n subpage; worse, the result depends on the wiki you’re on: JSON is expected on wikis with Translate but Lua on wikis without Translate. Modules meant to be shared across (both multilingual and monolingual) wikis may use /i18n for i18n in Lua: existing examples include Module:Wd/i18n, Module:Excerpt/i18n and Module:Documentation/i18n.

The best solution would be if MediaWiki presented a choice to the user when they start to write a new page if the content type is ambiguous, although that seems a big change (and we still need a default, which is used e.g. when the page is created via the API, to avoid breaking changes).

I might be misunderstanding because I lack context, but if this is to make modules translatable wouldn't a slot on the Module page be better for that? Instead of having to add magic to the title to set the content model it would be tied to a specific slot of the current module page. It's more feasible avoiding conflicts with other things that way too.

I might be misunderstanding because I lack context, but if this is to make modules translatable wouldn't a slot on the Module page be better for that? Instead of having to add magic to the title to set the content model it would be tied to a specific slot of the current module page. It's more feasible avoiding conflicts with other things that way too.

Quite possibly so, but I suspect that it will require more development.

siebrand changed the subtype of this task from "Task" to "Feature Request".Aug 31 2026, 8:19 AM
siebrand moved this task from Backlog to message bundles on the MediaWiki-extensions-Translate board.