Last modified: 2014-10-31 20:02:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T74584, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 72584 - OOUI PHP: Be able to set widgets' direction to RTL/LTR
OOUI PHP: Be able to set widgets' direction to RTL/LTR
Status: RESOLVED FIXED
Product: OOjs UI
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Normal enhancement
: ---
Assigned To: Bartosz Dziewoński
:
Depends on:
Blocks: 72713
  Show dependency treegraph
 
Reported: 2014-10-27 21:15 UTC by Bartosz Dziewoński
Modified: 2014-10-31 20:02 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bartosz Dziewoński 2014-10-27 21:15:40 UTC
(Migrated from http://etherpad.wikimedia.org/p/OOUIPHP)

Q: Grid layout needs to know whether it is LTR or RTL, how do we teach it that? This looks impossible to fix unless we introduce some global thingy to define the direction to use for all OOUI elements (static method/property on OoUiElement, possibly), or store this information in every Element.
A: This is a very good question, I want to ask Roan about his thoghts here, but my fist thoughts are that we will need to provide the equivelent to the way we detect the direction as what is on the client or keeping the libraries in sync will be quite difficult
Comment 1 Bartosz Dziewoński 2014-10-30 22:14:10 UTC
In JS, there's a static method OO.ui.Element.getDir that is used to determine direction. It goes like this:

OO.ui.Element.getDir = function ( obj ) {
	<blah blah>
	<'obj' is usually 'document.body' at this point>
	return $( obj ).css( 'direction' );
};

In PHP, we have this so far:

class OoUiElement extends OoUiTag {
	<snip>
	public static function getDir() {
		// TODO: Figure out a way to override this functionality when used within MediaWiki, and use
		// $wgLang->getDir() to get the user interface direction
		return 'ltr';
	}
}

Subclassing OoUiElement doesn't look viable, so that leaves us with the option of adding OoUiElement::setDir() method that the environment may call to set things up (similarly to how one calls `OoUiTheme::setSingleton( new OoUiMediaWikiTheme() )`).

If we also did this in JS, and used that value as a fallback, and went a bit further in that direction, it could probably become possible to use JS OOUI server-side, too; so that might not be a bad idea in general.
Comment 2 Gerrit Notification Bot 2014-10-31 16:09:01 UTC
Change 170341 had a related patch set uploaded by Bartosz Dziewoński:
OOUI PHP: Support RTL text direction

https://gerrit.wikimedia.org/r/170341
Comment 3 Bartosz Dziewoński 2014-10-31 18:12:01 UTC
There's also the bigger question of whether we want to support per-document or per-element directionality.

Currently JS sorta-kinda supports per-element directionality, but it's largely by chance – per comment 1, we just look at CSS 'direction' property and use that. We don't support changing the direction of existing elements. I don't think anybody has tried actually using this and seeing what happens when you mix-and-match.

I discussed it with Moriel on IRC and for now we're only going to support per-document directionality in PHP, and implement per-element support when it turns out that we actually need it.
Comment 4 Gerrit Notification Bot 2014-10-31 19:39:54 UTC
Change 170341 merged by jenkins-bot:
OOUI PHP: Support RTL text direction

https://gerrit.wikimedia.org/r/170341

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links