To remove the need for this, perhaps we should introduce a NamespaceNameLocalizer interface, with methods like getNamespaceName( $lang, $ns ), getFormattedNamespaceName( $lang, $ns ), and getGenderedNamespaceName( $lang, $ns ).
if ( $nsVariantText === false ) {
// No message exists, retrieve it from the target variant's namespace names.
$langObj = $this->mLangObj->factory( $variant );//todo: create from services
$nsVariantText = $langObj->getFormattedNsText( $index );
}
$cache->set( $key, $nsVariantText, 60 );
return $nsVariantText;
}