Page MenuHomePhabricator

Avoid mutual dependency between LanguageConverter and Language by introducing specialised interfaces
Open, HighPublic20 Estimated Story Points

Description

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;
	}

Related Objects

Event Timeline

Would be nice, but I'd push taht back. LanguageConverter knowing about Language isn't a huge problem. Language knowing about LanguageConverter is a lot worse.

Helga_sf set the point value for this task to 20.Apr 30 2020, 3:08 PM
Peter.ovchyn renamed this task from Avoid LanguageConverter from usage of Language by introducing specialised interface to Avoid mutual dependency between LanguageConverter and Language by introducing specialised interfaces.May 7 2020, 4:43 PM
  1. In T252137 I introduced namespaceNameLocalizer class and 2 interfaces that contains functions related to namespace names localization.
  2. The idea was to inject those interfaces into LanguageConverter and remove the dependency on Language. But it didn't remove circular dependency as indirectly objects still physically dependant.
  3. The diagram that demonstrates the problem can be found by link: https://miro.com/app/board/o9J_ktwtSJo=/?moveToWidget=3074457348173070591&cot=13

the hard copy is attached as image:

Screenshot 2020-05-28 at 13.36.18.png (1×2 px, 808 KB)

Next steps:
  1. T253834 - technical stuff, should make refactoring of LanguageConverter simpler
  2. T253849 - Move convertNamespace and convertTile out of LanguageConverter
  3. T253854 -Factor loadTable out of LanguageConverter
  4. T253460 - Finish
Peter.ovchyn raised the priority of this task from Low to High.
Aklapper added a subscriber: roman-stolar.

@roman-stolar: Removing task assignee as this open task has been assigned for more than two years - See the email sent to task assignee on October 11th.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome! :)
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!