Background
It is possible to create pages and sections with preloaded text, using the preload URL parameter.
When a translateable page is the target of the preload param, it would be helpful to fall back to an appropriate language if a particular translation does not exist. For an example of where we might want to do this, see T296272#7619882.
We can do this using Special:MyLanguage, which redirects to a translated version of a given page in the user's language, using the fallback chain if a translation is missing in that language.
Acceptance criteria
When the target of the preload param is a translateable page for a language that does not yet have a translation, the page for the next available language in the fallback chain is preloaded instead. This should work for:
- action=edit https://gerrit.wikimedia.org/r/755335
- veaction=edit and veaction=editsource https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/ /755926
Notes
Requirements for testing:
- Translate extension (see configuration docs and related pages)
Example steps for testing (non-VisualEditor):
- Create a page e.g. TranslateablePage, and translate it into a language that other languages fall back to (helpful tutorial here), e.g. TranlsateablePage/fr
- Create a new page with this page preloaded, with the language set to one that falls back to the translated language, e.g. NewPage?action=edit&preload=Special:MyLanguage/TranslateablePage&uselang=frp (frp falls back to fr)
- Expected: The editor for NewPage is pre-filled with the contents of TranslateablePage/fr (assuming no tranlsation exists for frp)
Example steps for testing (VisualEditor):
- Requires the VisualEditor extension: https://www.mediawiki.org/wiki/Extension:VisualEditor#Setting_up_VisualEditor
- Do as above, but with veaction=edit and veaction=editsource, instead of action=edit