Page MenuHomePhabricator

TUX should not use a wrong uselang value as fallback
Closed, ResolvedPublic


I tried to understand how meta:Translations:Universal_Code_of_Conduct/2021_consultations/Announcement/1/ha-latn could be created whereas ha-latn is a wrong language code and T124013 has been fixed.

I just noted that Special:Translate?uselang=ABCDEFG automatically adds &language=abcdefg URL parameter and allows to create messages in Translations: namespace with /abcdefg language code.


Special:Translate no longer allows making translations to unknown languages.

Event Timeline

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

[mediawiki/extensions/Translate@master] SpecialTranslate: Fix validation for target language code

abi_ added a subscriber: abi_.

I was able to reproduce this issue locally with the given steps. The translation unit pages with invalid language codes are being created, but the translation page itself doesn't get created due to a check in TranslatablePage::isTranslationPage.

$codes = Language::fetchLanguageNames();
global $wgTranslateDocumentationLanguageCode;
unset( $codes[$wgTranslateDocumentationLanguageCode] );

if ( !isset( $codes[$code] ) ) {
		return false;

I've added a check when loading the messages on Special:Translate, that will avoid the page being loaded when the user tries to translate to an unknown language code.

image.png (326×1 px, 33 KB)

Change 713601 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] SpecialTranslate: Fix validation for target language code