Page MenuHomePhabricator

Detect the directionality at the cursor position
Closed, InvalidPublic


Author: gangleri



If one want to generate a list / template / special page rendering (opticaly)
a) in a LTR environment as:
{{{TEXT1}}} {{{TEXT2}}} ({{{TEXT3}}}) ({{{TEXT4}}}) [{{{TEXT5}}}]
b) in a RTL environment as:
[{{{TEXT5}}}] ({{{TEXT4}}}) ({{{TEXT3}}}) {{{TEXT2}}} {{{TEXT1}}}
and the directionality of the TEXTn is not known 100%

then one can avoid unwanted content "mixing" due o the bidirectional algorithm
by adding {{DIRCURSOR:mark}} after " ", "(", ")", "[", "]" and all other
character with "neutral directionality".

See a draft example at [[meta:User:Tietew/RTL_problem#another_solution]].

The implementation of
Bug 4050: "BiDi: orientation and numbering inside a TOC should be left aligned
if placed in a LTR block and RTL if not"
would need a (global?) variable $dircursor / $cursordir (or similar) which
should use a stack.

When parsing the source code each occurrence of dir="foo" in a "block" should
"push" "foo"; at the end of the "block" the previous value should be restored
with "pop". Note: paragraphs, cells etc. define distinct blocks (please verify
with the specifications)

The availability of variables {{DIRCURSOR}} / {{CURSORDIR}} (or similar) or
better predefined templates {{DIRCURSOR:}} / {{CURSORDIR:}} (or similar) would
help to generate pages that render optimal in a BiDi environment.

CURSOR type predefined templates / magic words should be used togeter with
a) 'mark' and generate ‎ / ‏
b) 'dir' and generate ltr / rtl

Optimaly rendering in the provided example can only be assured if one knows the
directionality of each TEXTi exactly: "foo (bar)" is a typical example. 100%
correct rendering should use either "foo (bar)‎" for LTR text or "foo
(bar)‏" for RTL text or "foo (bar)" for BiDi text.
As a consequence of this each peace of text needs a directionality attribute.
This will be another request.

{{DIRCURSOR:dir}} would / might be required for constructs like
dir="{{DIRCURSOR:dir}}" for neighbour blocks / subblocks.

Please note that
Bug 4126: BiDi feature request: please create a variable {{CONTENTDIR}}
is a request for a new variable about a the directionality of the content
language. [[template:wikivar]] is using as a workaround [[template:DIRMARK]] to
asure "portability" of this tamplate between LTR and RTL wikies.

Fixing some of the bugs dependending of the BiDi tracking bug 745
will require also a variable $guidir / $dirgui (which may be transparent as
{{GUIDIR}} / {{DIRGUI}}.
These bugs are related to page areas / items as the "personal tools", the tabs,
navigation and toolbox area, page footer etc. which should be rendered with an
opposite directionality when such a user interface is selected / such a
"uselang=" is used.

best regards reinhardt [[user:gangleri]]

P.S. Some of topics are addressed at [[meta:Talk:Multilingual_MediaWiki]]. I
mentioned the further requirements (not covered by the summary) in order to
select similar names for both the global variables and / or the MediaWiki
{{foo}} type variables.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:02 PM
bzimport set Reference to bz4742.
bzimport added a subscriber: Unknown Object (MLST).