Page MenuHomePhabricator

Support RTL in WikiHiero
Open, Needs TriagePublic

Description

Ancient Egyptian hieroglyphs could be written from left-to-right as well as from right-to-left.
Currently, WikiHiero supports only producing LTR hieroglyphs.
Having it able to produce RTL hieroglyphs would make them more suitable for inclusion in wikis in languages written from right to left, such as Arabic, Farsi, etc, where they will have the same reading direction as the main body text.

Event Timeline

The outcome of <hiero> shall reproduce the same graphics as written milleniums ago.

The produced graphics does not depend on writing direction of the language context where such graphics are embedded.

  • If you mention latin words on an arabic or hebrew page, they keep their writing direction. They will be presented as LEFT and not as TFEL.
  • For the same reasons, arabic or hebrew quotations within an english page do not change order of letters (which would break some arabic texts since they depend on neighbouring letters).

For me, the request more suitable for inclusion in wikis in languages written from right to left seems to be invalid.

Another issue are rumours that single hieroglyphs might occur in a mirrored version.

  • It is not proven yet, citation needed.
  • If it turns out that horizontally mirrored single glyphs are really needed, each glyph specifier might be preceded by a - and result in a mirrored variant as e.g. OOUI icons do for RTL business.

When I wrote the original ticket, I was assuming a certain shared understanding of the Egyptian hieroglyphic writing system. So let me clarify:

The outcome of <hiero> shall reproduce the same graphics as written milleniums ago.

Millennia ago, hieroglyphs were written in both directions. There are almost as many samples of writings where the glyphs are drawn facing the right as many that are drawn facing the left. The direction of the glyphs indicates the direction of reading.

The image in Britannica's article on hieroglyphs shows a sample where the direction of writing and reading is from right: to left: https://www.britannica.com/topic/hieroglyph

There are others sources online, and I have many photos I took myself of monuments that I can share here, if needed.

The produced graphics does not depend on writing direction of the language context where such graphics are embedded.

That would have been true had <hiero> was only being used to reproduced writings from actual historic artefacts, citing their actual material sources. For example, to reproduce the writings from a specific monument or papyrus. But even then writing from right to left is attested, and would be needed here.

However, reproducing actual writings is not even the main usecase of <hiero> in Wikipedia currently, from what I observe. Rather, it is used to re-create the hieroglyphic representations of the names of deities and persons, and could be used to reproduce the names of places, among other uses. In cases like these, where the reproduced hieroglyph is not documenting a specific historic sample, there's no reason why the hieroglyphic writing not be made to match the direction of reading of the contextual language, i.e Arabic, Farsi, or Hebrew, etc, or even in a Latin script Wikipedia in order to simply demonstrate this property of the writing system itself, where that is relevant.

  • If you mention latin words on an arabic or hebrew page, they keep their writing direction. They will be presented as LEFT and not as TFEL.
  • For the same reasons, arabic or hebrew quotations within an english page do not change order of letters (which would break some arabic texts since they depend on neighbouring letters).

I know about Arabic and Hebrew and many other right-to-left scripts. This reply is irrelevant to what I had written, and to this discussion.

There are three issues which are mixed and confused in this task. They should be distinguished clearly.

The graphical appearance generated by the extension.

  • That shall reproduce exactly what has been put 4000 years ago on a wall or a papyrus.
  • The graphics shall show exactly the same what is visible on a truly oriented photograph.
  • It does not matter at all how these graphical elements are read and interpreted semantically and what they mean.

The source code order

  • When computer code is written in arabic or hebrew or cyrillic or japanese context, it is written in latin letters and it is keeping their writing and reading direction (from left to right) under any circumstances, no matter what the context language might be.
  • The following example is written and read by software from left to right, whatever the context might be.

In the same way the inner code between <hiero> and </hiero> shall produce always the same graphics, no matter what the graphical elements might mean:

function main ( args ) {
    ...
}

The meaning of the text

  • If it is not an historical inscription, but you want to teach someone how to decipher the name of a pharao, how graphical elements are combined to express vowels, syllabes, words, then it might be meaningful to follow the common reading direction, be it arabic or hebrew or latin or cyrillic.
  • In this tutorial you know the language context, and you might choose an appropriate reading direction, and you may arrange the glyphs in helpful and comprehensive order.
  • However, when making a Wiki extension computer code, you are arranging this between <hiero> and </hiero> in latin letters (ASCII) in such order to gain the graphics you are heading for.
  • The extension does not care about the meaning of the generated graphics, and how human beings might interprete them. The software is just translating ASCII tokens into graphics.
  • If you want them to appear in reverse order then arrange the ASCII elements in reverse order.

Unanswered question

The lengthy answer has not answered: single hieroglyphs might occur in a mirrored version.

  • That does mean: In common practice a bird is looking e.g. to the right.
  • That might be the case only if this is semantically read from left to right.
  • If semantically read from right to left: Does it occur that this bird has been painted looking to the left 4000 years ago? Or is he still looking to the right?

If it is proven that mirrored birds occur, we will need mirrored images for single tokens. Then the token should be preceded by a - and some bot needs to produce all non symmetric images with a systematic name variation.

Aklapper renamed this task from RTL in WikiHiero to Support RTL in WikiHiero.Aug 4 2022, 4:45 AM
Restricted Application added a subscriber: Huji. · View Herald TranscriptAug 4 2022, 4:45 AM

Hi, I'm back :)

There are three issues which are mixed and confused in this task. They should be distinguished clearly.

The graphical appearance generated by the extension.

  • That shall reproduce exactly what has been put 4000 years ago on a wall or a papyrus.
  • The graphics shall show exactly the same what is visible on a truly oriented photograph.
  • It does not matter at all how these graphical elements are read and interpreted semantically and what they mean.

In order to clarify this confusion, please refer to my previous reply regarding the historical occurrences of hieroglyphs in both directions, as an intrinsic property of the writing system.

The source code order

  • When computer code is written in arabic or hebrew or cyrillic or japanese context, it is written in latin letters and it is keeping their writing and reading direction (from left to right) under any circumstances, no matter what the context language might be.
  • The following example is written and read by software from left to right, whatever the context might be.

In the same way the inner code between <hiero> and </hiero> shall produce always the same graphics, no matter what the graphical elements might mean:

function main ( args ) {
    ...
}

The meaning of the text

  • If it is not an historical inscription, but you want to teach someone how to decipher the name of a pharao, how graphical elements are combined to express vowels, syllabes, words, then it might be meaningful to follow the common reading direction, be it arabic or hebrew or latin or cyrillic.
  • In this tutorial you know the language context, and you might choose an appropriate reading direction, and you may arrange the glyphs in helpful and comprehensive order.
  • However, when making a Wiki extension computer code, you are arranging this between <hiero> and </hiero> in latin letters (ASCII) in such order to gain the graphics you are heading for.
  • The extension does not care about the meaning of the generated graphics, and how human beings might interprete them. The software is just translating ASCII tokens into graphics.
  • If you want them to appear in reverse order then arrange the ASCII elements in reverse order.

In order to be clear with this point: I was not concerned with any implementation details in the original ticket. I'm only concerned with the visible appearance of the glyphs produced by the extension.

Unanswered question

The lengthy answer has not answered: single hieroglyphs might occur in a mirrored version.

  • That does mean: In common practice a bird is looking e.g. to the right.

Yes. The bird can be looking to the right on monuments and papyri in existing historical artefacts. I'm also sure you're capable of finding many sources on the hieroglyphic writing system.

  • That might be the case only if this is semantically read from left to right.

I do not understand what this statement means (or is it a question?).
But to confirm: the reading order flows from right to left whenever the glyphs are facing right.

  • If semantically read from right to left: Does it occur that this bird has been painted looking to the left 4000 years ago? Or is he still looking to the right?

To a reader who lived 4000 years ago, the direction of the reading was determined by the direction the glyphs are facing. When a reader looked at the wall and saw the animals, birds and humans facing right, they figured out that decoding this inscription entails reading the glyphs from right to left.

If it is proven that mirrored birds occur, we will need mirrored images for single tokens. Then the token should be preceded by a - and some bot needs to produce all non symmetric images with a systematic name variation.

Some implementation suggestions here:

Can't the code flip the images by a graphic transformation at the time of rendering, instead of duplicating the glyphs set in the extensions resources? I haven't checked again recently, but I remember the glyphs were vector graphic files, correct?

Also, instead of preceding each token with a dash, it would be much more practical, and less prone to errors on part of users of the extension, if an optional single token was to be placed at the beginning of the sequence to indicate the direction.
Ideally, this should be accompanied by a settable global default at the level of the extension's instance. This way, a right-to-left mediawiki instance will default to rendering hieroglyphs RTL unless otherwise indicated, and vice versa for a LTR wiki instance.

Moreover, copying codes from one wiki to the other will work without requiring modifications, as well as intra-wiki sharing, when applicable, such as with transclusion, and hopefully shared global templates, whenever that is implemented in MW.

What do you think?

Meanwhile I learnt that our extension permits mirroring of a single glyph. Please try

  • <hiero>G11</hiero>
  • <hiero>G11\</hiero>

Just append a backslash \.

This solves the problem of LTR instead of RTL.

For the entire text, you will find yourself in the less satisfying situation of

  • H\P\Y\L\G\O\R\E\I\H\

However, you might find a smart person who will be able to write a script that

  • adds or removes all \
  • changes the sequence of the glyph IDs from big endian to little endian, as IT people are calling this exercise.

Addendum: It might be that the backslash syntax is part of the WikiHiero specification, but not available on-wiki. Or Gardiner himself.

Special:Hieroglyphs in any wiki does understand it, but tag syntax apparently not.

Postpostscriptum: It works on regular pages, but not inside Flow discussions. Whyever.

Can't the code flip the images by a graphic transformation at the time of rendering, instead of duplicating the glyphs set in the extensions resources? I haven't checked again recently, but I remember the glyphs were vector graphic files, correct?

Also, instead of preceding each token with a dash, it would be much more practical, and less prone to errors on part of users of the extension, if an optional single token was to be placed at the beginning of the sequence to indicate the direction.
Ideally, this should be accompanied by a settable global default at the level of the extension's instance. This way, a right-to-left mediawiki instance will default to rendering hieroglyphs RTL unless otherwise indicated, and vice versa for a LTR wiki instance.

The images are PNGs, but I don't think that matters.

One option would be to set the outer table's direction to RTL (to cause the images to flow from right to left) and then use CSS to mirror the images themselves. I just tested on https://test.wikipedia.org/wiki/Wikihiero using https://test.wikipedia.org/wiki/Template:WikihieroRTL and https://test.wikipedia.org/wiki/Template:WikihieroRTL/styles.css and it seems to work.

Having to create that template on every wiki would be silly though, so it would good for the extension to support it itself.
The extension already adds dir="ltr" to the outer table it creates. Maybe it could support something like <hiero dir="rtl"> which would output dir="rtl" instead, plus something like this in the extension's CSS:

.mw-hiero-outer[dir="rtl"] img {
	transform: scaleX(-1);
}

.mw-hiero-outer[dir="rtl"] img.mw-mirrored {
	transform: none;
}

Nice idea.

However I am not sure that the requested use case is really needed in the real world.

We should dig out some contemporary writers and ask them how they used the glyphs.

Or at least ancient egyptians on English Wikipedia to make a consolidated statement whether it is reaonable to provide such things in a wiki. This might give more hints whether every glyph is mirrored, or each glyph is keeping direction but sequence is RTL, or LTR with mirrored glyphs.

ahmad already explained how they're written/read on more than one occasion:

Millennia ago, hieroglyphs were written in both directions. There are almost as many samples of writings where the glyphs are drawn facing the right as many that are drawn facing the left. The direction of the glyphs indicates the direction of reading.

The image in Britannica's article on hieroglyphs shows a sample where the direction of writing and reading is from right: to left: https://www.britannica.com/topic/hieroglyph

But to confirm: the reading order flows from right to left whenever the glyphs are facing right.
[...]
To a reader who lived 4000 years ago, the direction of the reading was determined by the direction the glyphs are facing. When a reader looked at the wall and saw the animals, birds and humans facing right, they figured out that decoding this inscription entails reading the glyphs from right to left.

You can ask someone else if you want, but they'll just tell you the same thing.

Here's some more examples anyway:

I agree that having support in WikiHiero for rendering the hieroglyphs in RTL order would be useful.
By the way, some information on historical writing direction of hieroglyphs can be found on English Wikipedia here.