Module talk:Interlinear

(Redirected from Module talk:Interlinear/sandbox)
Latest comment: 8 months ago by Eievie in topic Template overhaul

Intro

edit

This is an organically grown module: it started out small and simple, but over time various bits got added, then rewritten and trimmed, all at different times and in different styles, so the result is probably quite unreadable. Be warned before approaching the code.

The major items I've got on the to-do list are (sorry, no improvements in readability down the pipe!):

  • Revamp styles and classes in accordance with mw:Extension:TemplateStyles, whenever that extension becomes available on the English wikipedia (check at Special:Version)
  • Make lang= invoke Module:Lang, whenever that has settled
  • Rewrite the bletcherous parser function. This will make more sense if done at a time when we will be able to use (as an extension or a module) either an XML parser, or at least a proper regex engine.

All these things are dependent on the presence of external factors, so the main task at the moment is to wait until they become available. – Uanfala (talk) 20:28, 12 December 2017 (UTC)Reply

Automatic transliteration

edit

I really like what the module does. I'm experimenting with using it for Ancient Greek example sentences in User:Erutuon/Ancient_Greek interlinear glossing, though it might not be used in articles anytime soon because it's untraditional – not typically used in teaching Ancient Greek.

So, the Ancient Greek examples have automatically generated transliteration, which I enter by copying the Greek text into {{grc-tr-bare}} in a separate parameter from the Greek text, but I was thinking that perhaps the module could use the transliteration module (Module:Ancient Greek) to automatically generate transliteration, retrieving the name of the module and the name of the exported function for the language from a table. That would be more convenient.

For example, from this method of inputting the example –

{{fs interlinear|lang=grc
|'''Σωκράτ-ης''' γὰρ '''σοφ-ὸς''' ἦν καὶ '''δίκαι-ος'''
|{{grc-tr-bare|'''Σωκράτ-ης''' γὰρ '''σοφ-ὸς''' ἦν καὶ '''δίκαι-ος'''.}}
|Socrates-NOM.SG for wise-NOM.SG be.IMPERF.3.SG and just-NOM.SG.
|For '''Socrates''' was '''wise''' and '''just'''.
}}

Σωκράτ-ης

Sōkrát-ēs

Socrates-NOM.SG

γὰρ

gàr

for

σοφ-ὸς

soph-òs

wise-NOM.SG

ἦν

ên

be.IMPERF.3.SG

καὶ

kaì

and

δίκαι-ος

díkai-os.

just-NOM.SG.

Σωκράτ-ης γὰρ σοφ-ὸς ἦν καὶ δίκαι-ος

Sōkrát-ēs gàr soph-òs ên kaì díkai-os.

Socrates-NOM.SG for wise-NOM.SG be.IMPERF.3.SG and just-NOM.SG.

For Socrates was wise and just.

– to this –

{{fs interlinear|lang=grc
|'''Σωκράτ-ης''' γὰρ '''σοφ-ὸς''' ἦν καὶ '''δίκαι-ος'''
|Socrates-NOM.SG for wise-NOM.SG be.IMPERF.3.SG and just-NOM.SG.
|For '''Socrates''' was '''wise''' and '''just'''.
}}

Σωκράτ-ης

Socrates-NOM.SG

γὰρ

for

σοφ-ὸς

wise-NOM.SG

ἦν

be.IMPERF.3.SG

καὶ

and

δίκαι-ος

just-NOM.SG.

Σωκράτ-ης γὰρ σοφ-ὸς ἦν καὶ δίκαι-ος

Socrates-NOM.SG for wise-NOM.SG be.IMPERF.3.SG and just-NOM.SG.

For Socrates was wise and just.

– but with the transliteration automatically generated.

Anyway, it's an idea. It is probably not time to try to implement it, as Ancient Greek isn't using the template in entries yet. — Eru·tuon 08:59, 23 January 2018 (UTC)Reply

I've added a very tentative version of the functionality you've described. It only works from {{fs interlinear}}:
{{fs interlinear|lang=grc
|'''Σωκράτ-ης''' γὰρ '''σοφ-ὸς''' ἦν καὶ '''δίκαι-ος'''
|auto
|Socrates-NOM.SG for wise-NOM.SG be.IMPERF.3.SG and just-NOM.SG.
|For '''Socrates''' was '''wise''' and '''just'''.
}}

Σωκράτ-ης

Sōkrát-ēs

Socrates-NOM.SG

γὰρ

gàr

for

σοφ-ὸς

soph-òs

wise-NOM.SG

ἦν

ên

be.IMPERF.3.SG

καὶ

kaì

and

δίκαι-ος

díkai-os

just-NOM.SG.

Σωκράτ-ης γὰρ σοφ-ὸς ἦν καὶ δίκαι-ος

Sōkrát-ēs gàr soph-òs ên kaì díkai-os

Socrates-NOM.SG for wise-NOM.SG be.IMPERF.3.SG and just-NOM.SG.

For Socrates was wise and just.

If a line supplied by the template is the string "auto" then that line is replaced by the automatic transliteration of the preceding line. How is that for usability? The alternative from your examples is for the module to guess from the total number of lines supplied (if there are three instead of the expected four) and to assume that it's the first line that needs to be transliterated. These are reasonable assumptions most of the time, but I think they will make it unreasonably difficult to use the feature in other contexts (say, if there are source sentences in more than one language or script, with each needing to be transliterated). What do you think? If the word "auto" can be replaced with something more intuitive, go ahead. The actual transliteration happens in function transliterate. Feel free to pick that up from where I've left it.
As it's currently set up, the transliterator is chosen based on the lang code (if the source sentene is the nth unnamed parameter, then first |langN= is looked up and if it's missing then |lang= is used). I don't know if it's reasonable to try to make the module guess based on the script used. Ultimately, I guess there should be support for different transliteration schemes, as well as for backward transliteration (from a Roman-based scheme into a foreign script).
Given that automatic transliteration is not needed solely in interlinear glosses, I think there should be an umbrella metamodule to handle all automatic tranlsiterations, loading modules for individual scripts/languages as and when required. Any thoughts? – Uanfala (talk) 03:38, 27 January 2018 (UTC)Reply
I have corrected the repetitions of "wise" to "just" in the above examples. -- Mirokado (talk) 13:41, 27 January 2024 (UTC)Reply

Argument scenarios

edit

What's the right thing to do when there are fewer than 3 arguments? The documentation is conflicting on this point.

1 arg 2 args 3 args
Line 1 No Italics
Spacing
Glossing
Italics??
Spacing
No Glossing??
Italics
Spacing
No Glossing
Line 2 No Italics??
Spacing??
Glossing??
No Italics
Spacing
Glossing
Line 3 No Italics
No Spacing
No Glossing

In particular, if there are only 2 arguments (lines), what do the first and second ones most likely represent? I would say native language + gloss, but the current implementation appears to be native language + free translation. (IMO, if you're not actually glossing, why use this template in the first place? The first line would have special spacing for no reason.) Thoughts? —Gordon P. Hemsley 12:35, 11 July 2019 (UTC)Reply

  • The relevant part of the documentation is in the last paragraph of Template:Interlinear#Basic usage. Given that the module can be used with any number of lines, I thought it was simpler to have one rule for all cases of more than one line: 1a) the last line is treated as the free translation and so isn't interlinearised; 1b) to omit a free translation, supply an empty last line. I agree that for two lines it's almost certain the intended use is native language + gloss, so it's possible to add an exception for this case, but doing so would add an extra rule that users may need to know. It will also make it impossible to format two lines as native language + free translation, so we must be completely sure this is never going to be needed. – Uanfala (talk) 22:52, 11 July 2019 (UTC)Reply
The conflict is that Template:Interlinear#Glossing abbreviations states that the second line will be assumed to be glossing if no glossing line is specified – so the problem arises of what happens when the second line and the last line are the same line. It may turn out that this is simply a matter of clarifying the documentation. (Admittedly, despite multiple attempts to find such information, I missed the part where it says how to force the last line to be interlinearized. It might be worth making that stand out more and/or putting it in multiple sections.) —Gordon P. Hemsley 11:42, 12 July 2019 (UTC)Reply
Oh, I see, I hadn't noticed that. So it turns out we have extra complexity either way: either it's assumed the second line contains glosses unless there are altogether only two lines, or the last line is always assumed to be the free translation unless the last line is the second line. So we need to either change the behaviour of the module, or update the documentation. Both changes are trivial to make, so the question is which of the two alternatives results in greater usability. Any thoughts? – Uanfala (talk) 12:36, 12 July 2019 (UTC)Reply
You raised an important point earlier about being completely sure that no one is going to want to format two lines as native language + free translation, and that gave me pause. However, I can't think of a valid scenario where you would want to interlinearize a single line of text up against a free translation. Which brings into question why the single line behavior is the way it is—are we able to find examples of single line interlinearization that we can conceive adding a line of free translation to? —Gordon P. Hemsley 21:56, 12 July 2019 (UTC)Reply

Yeah, there's no need to interlinearise if it's just a single line (so that aspect of the behaviour of the template will need to change). I guess the way I had envisaged that two-line use is for a native language sentence + free translation, without glosses. And that's kind of what's done in the two real-world examples I was able to find [1] [2]. In a way, there's no need for using this (or any other) template here. But if you need to use some of this template's bells and whistles (or if you don't, but are forced to for consistency with uses of the template in the same article), that will be difficult to do. An example:

1a)

fai

woman

re-t-o

specific.location-near-U

fai re-t-o

woman specific.location-near-U

'this woman'

1b)

fai

re-f-o

fai re-f-o

'this woman very near'

Uanfala (talk) 22:31, 12 July 2019 (UTC)Reply

Ah, interesting examples. It seems to me these would more intuitively marked up by leaving the second line blank for these examples—where the glossing is implied by context. What do you think about that inversion (opting out of the second line instead of opting out of the third line)? Other thoughts: (1) I agree there's little reason to use this template for single words, though I suppose there's no way or even reason to stop someone from trying. (2) Should/can we do something to normalize quotation marks around the free translation? —Gordon P. Hemsley 14:42, 13 July 2019 (UTC)Reply
Normalising quotation marks, as in making sure across wikipedia only one type is used, I'd assume the single one? I have no opinion on that and won't object if anyone does it.
I hadn't thought of marking up the second line as blank, but now that you mention it, it does seem more intuitive in this particular case. But such a rule wouldn't scale up well to cases with more than three lines. An alternative I can think of is to change the default "glossing" line to be not the one that's second (counting from the start), but the one that's last but one. This seems like a good idea anyway: if there are many lines involved, the line with glosses is most likely to be the last one before the free translation, as extra lines are most often used to give several versions of the native text (different writing systems or transliterations, with or without morpheme breaks, etc.). What do you think? – Uanfala (talk) 18:07, 13 July 2019 (UTC)Reply
I think that makes sense, from both perspectives. Lines 1 to (n−2) are interlinearized; line (n−1) is the gloss; line n is the free translation. Then n<3 becomes more obvious (n=1 would be free translation only; n=2 would be glossing + free translation), and it is easy to skip any section. Though this does bring back the question of why you would use this template with only one line.
Regarding quotation marks, I was pondering whether the free translation should be automatically wrapped in quotation marks, as opposed to added (or not added) by the author. I'm fine if we consider that separately, or not at all. —Gordon P. Hemsley 12:22, 14 July 2019 (UTC)Reply
Before you spelt it out, I guess I hadn't completely understood the obvious implication of the "glossing at n-2" rule for the case of n = 2. So that means glosses + free translation? I think that's probably the least likely way to use just two lines of "interlinear" text. But at least it makes the two likelier cases a lot more intuitive: want it without a free translation? – supply an empty last line; don't want a line of glosses? – let the second line be empty.
As for n = 1, I don't think anyone would expect {{interlinear}} to do anything at all in this case. I've added this functionality because we generally do need a way to easily format a long string containing several grammatical abbreviations (as found in glosses): it's better to have the following example – 1SG.SUBJ-3SG.OBJ-mach-APPL – created like this:
{{Some template|1SG.SUBJ-3SG.OBJ-mach-APPL}}, than like that:
{{gcl|1SG}}.{{gcl|SUBJ}}-{{gcl|3SG}}.{{gcl|OBJ}}-mach-{{gcl|APPL}}.
It's good to have some template do that, and I reckoned it might be easier to let that be the same template that formats multiple-line glosses. It's not that counter-intuitive, and it doesn't get in the way of other people using the template with n>2. What do you think?
I don't think quotation marks should be automatically added to the free translation. Because it's not always just a free translation: the last, non-interlinearised, line can also contain explanations (in addition to or instead of a free translation) or references. – Uanfala (talk) 22:56, 16 July 2019 (UTC)Reply

Proposed changes to behaviour with unusual numbers of lines

edit

Our goals here are two-fold, right?

  1. Make the template usage intuitive.
  2. Make the common case the default case.

So I think we're in agreement now about what to do with 3 arguments but only two lines: simply skip the one you don't want to use. Code-wise, that means implementing (in the general case) line n as free translation, line n−1 as gloss, lines 1 through n−2 as non-gloss interlinear. For n=1, special case that the single line is gloss. For n=2, where the third argument is not explicitly left blank (to the extent that that's possible to determine), we can special case whatever the most likely scenario is if it differs from the general case.

If it makes sense, we could even implement the logic such that the gloss is the core of the template, and the addition of more lines means building up or down. So, n=1 means just the core: glossing; n=2 means build up: non-gloss interlinear, glossing; n=3 means build up then down: non-gloss interlinear, glossing, free translation; n=4 means build up then down then up: non-gloss interlinear, non-gloss interlinear, glossing, free translation; and so on. Does that make sense? —Gordon P. Hemsley 11:41, 18 July 2019 (UTC)Reply

I really like the idea of the gloss being the core of the template. This seems to capture all the normal use cases in a single scheme. But I'm a bit concerned about usability: n-1 is an easy rule to remember, n/2 rounded down plus one – not so much so. – Uanfala (talk) 22:10, 21 July 2019 (UTC)Reply
I think if the template is built in a logical way, you won't need to remember the rule in order to have accurate intuitions about it.   And besides, the rule need only be an implementation detail – I'm sure there are plenty of more easily memorized ways of explaining how to use it, including by making only minimal changes to the existing documentation. If you're on board, I say we go for it. —Gordon P. Hemsley 01:43, 22 July 2019 (UTC)Reply
In anticipation of some TDD, I've gone ahead and created Module:Interlinear/testcases and Module talk:Interlinear/testcases. (Documentation is at Wikipedia:Lua#Unit testing and Module:UnitTests.) —Gordon P. Hemsley 03:53, 22 July 2019 (UTC)Reply
Thanks for starting the test cases: I've been meaning to do that for a long time. As for the new logic, well, count me on board. First, we'll need to have a look at existing uses to see if this won't clash with their logic: I'll tweak the module to populate Category:Pages with interlinear glosses using more than three unnamed parameters, which should supply us with the needed data. If everything looks alright, I can implement the change whenever I get some more free time within the next couple of weeks. Or if you then feel like going ahead with it yourself, by all means do. I see you've started making improvements to the module: thanks for that! I just don't quite get what you did in this edit: isn't the additional code practically redundant to the bit further down, where you've added the newline? – Uanfala (talk) 20:44, 23 July 2019 (UTC)Reply

I admit that that edit is icky, but it was the quickest way to resolve an issue where explicitly specifying the same parameters as the defaults resulted in different output. (It was causing one or two of the new tests to fail.) There's probably a better way to fix that issue, but it would involve a broader refactoring of how things are output, which I didn't want to get into just yet.

I've been running the code through a linter to pick out some potential trouble points, and there are still a couple to address, but after that I'll look into what it would take to implement what we've laid out here. (I'm still working on familiarizing myself with both Lua and your code.) I'll probably start out by writing tests for what we expect the output to be, so we can coordinate on the progress to be made and any unexpected scenarios that may crop up. —Gordon P. Hemsley 12:52, 24 July 2019 (UTC)Reply

Oh yeah, I get what the problem was; the solution works for now. I've made a mention of the proposed changes at Template talk:Interlinear, and if no-one objects in a week or two, we can go ahead and implement it? In the meantime, I'll have a more detailed look at the existing uses tracked in the category. Also, I just thought I should mention (not that you won't have noticed already), that the module isn't really among the most readably written ones. – Uanfala (talk) 14:09, 26 July 2019 (UTC)Reply

Development

edit

Given your desire to socialize the change before we make it, I've created Module:Interlinear/testcases/parameters and Module talk:Interlinear/testcases/parameters to keep the development tests out of "production" until we've actually deployed the changes. Can you give them a look and make sure they match our expectations here? —Gordon P. Hemsley 20:15, 28 July 2019 (UTC)Reply

Comment on proposal and parameter choices

edit

@Uanfala: You invited comment on "this proposal", which linked only to this page, but I take it you meant the subsection above "Proposed changes to behaviour with unusual numbers of lines"? Now that I've read the entire page, and put that proposal in context, I do have a comment or two.

  1. First, congratulations! on just how good the {{gcl}} and {{interlinear}} are. And sincerely, thanks for all the hard work you've done.
  2. Second, I'm so glad to see you inviting (and achieving) productive dialogue with other editors. Seems that Gordon P. Hemsley has already made substantial contributions and will likely have much to offer, both as a linguist user and a coder comfortable with HTML and its styling. (Particularly impressed by his liking for test-driven development!)
  3. On the matter you asked about, as a rule I favour explicit parameters, rather than implicit ones. In the case at hand, that would mean providing an explicit name for each type of line in the interlinear, e.g. thus: {{interlinear[|source=<source-value>][|gloss=<gloss-value>][|literal-translation=<literal-value>][|free-translation=<free-value>]…}} with the code for each line having the form |keywordn=valuen, each keywordn being a line-type literal, valuen its value, brackets ([…]) representing optional arguments, the asterisk (*) representing zero or more occurrences of the bracketed item and the ellipsis (…) representing all other defined line-types.
  4. Of course, any per-line override keywords could also be given (either as a reserved keyword, or as a keyword=value pair) between the pipes "|" that separate the lines, thus: {{interlinear|source=<source-value>[ <source-override-m>]*|gloss=<gloss-value>[ <gloss-override-m>]*|literal-translation=<literal-value>[ <literal-override-m>]*|free-translation=<free-value>[ <free-override-m>]*|…}}, with each m numbering the distinct override keywords, and similarly for any other defined line-types.
  5. The chief benefit of naming parameters explicitly is the avoidance of any ambiguity. A consequence of this is that parameter ordering becomes much freer.

I'd be happy to hear your thoughts on using explicit vs. implicit parameters. @GPHemsley: yours too.

yoyo (talk) 02:56, 5 September 2019 (UTC)Reply

Hi, yoyo, and thanks for joining in! Yes, having explicit, named parameters for the lines is definitely an option. I didn't initially go for it because the template was created around the idea of ease of use in the most common case (the canonical three lines). Any editor who needs to add a simple interlinearised example can just write one straight off, without having to go to the template documention to look up the exact names of the parameters. I feel that this simple device – invoking the template with three unnamed parameters to create the typical glossed example – should continue to be available whatever system is eventually adopted for the unusual cases (n different from 3).
As to how it should all be set up for these more unusual cases, I don't really have preferences and I would like to hear what others think. The current system – all additional lines continue to be unnamed parameters and there's often a need for overrides like |glossing2=no – has the advantage of consistency with the simple case of n=3, but I'll have to admit it's not very elegant. If we switch to explicit parameters it will all be more transparent semantically, and that's good. But I don't know to what an extent it will be less complicated. At a minimum, the parameters for the line-types will need to be numbered (e.g. {{interlinear|source1=...|gloss2=...|literal-translation=...}}); this is to allow for non-canonical line orders (say, annotations before source text: {{interlinear|literal-translation1=..|source2=...|gloss3=...}}), and for multiple instances of each line type ({{interlinear|source1=...|source2=....|gloss3=...}}).
Maybe we could have a look at some examples?
Extended examples
Two source lines
Code in current setup (assuming GPHemsley's proposal is implemented):
{{interlinear|italics2=yes
|tauna angun kiturkiit
|tauna angun kitur-k-iit
|that.ABS man.ABS pass.by-PTCP.TR-3PL/3SG
|'They passed that man.'}}
Code with explicit parameters:
{{interlinear
|source1 = tauna angun kiturkiit
|source2 = tauna angun kitur-k-iit
|gloss3 = that.ABS man.ABS pass.by-PTCP.TR-3PL/3SG
|free-translation4 = 'They passed that man.'}}
Two lines of glosses
Code in current setup:
{{interlinear|glossing3=yes
|tauna angun kitur-k-iit
|that.ABS man.ABS pass.by-PTCP.TR-3PL/3SG
|Determiner Noun Verb
|'They passed that man.'}}
Code with explicit parameters:
{{interlinear
|source1 = tauna angun kitur-k-iit
|gloss2 = that.ABS man.ABS pass.by-PTCP.TR-3PL/3SG
|annotation3 = Determiner Noun Verb
|free-translation = 'They passed that man.'}}
Glosses before source text:
Code in current setup:
{{interlinear|glossing1=yes|italics=2
|that.ABS man.ABS pass.by-PTCP.TR-3PL/3SG
|tauna angun kitur-k-iit
|'They passed that man.'}}
Code with explicit parameters:
{{interlinear
|gloss1 = that.ABS man.ABS pass.by-PTCP.TR-3PL/3SG
|source2 = tauna angun kitur-k-iit
|free-translation3 = 'They passed that man.'}}

Both schemes tend to lead to complexity, but in different ways. I will be interested in what others think as well. GPHemsley? As for the overrides in point #4, I don't think I've got a clear picture; yoyo, would you give an example? – Uanfala (talk) 03:04, 9 September 2019 (UTC)Reply

Multiple bugs in Egyptian example

edit

Egyptian language#Old Egyptian has a bespoke glossing table, reproduced below:

d
D
n
f
N19
n
G38
f
M23 L2
t t
O1
F34
s
n
d(m)ḏ.n.f tꜣwj n zꜣ.f nsw.t-bj.t(j) pr-jb.sn(j)
unite.PRF.3SG[1] land.DUAL.PREP son.3SG sedge-bee house-heart.3PL
"He has united the Two Lands for his son, Dual King Peribsen."[2]

I have attempted to convert this to use {{Interlinear}}:

{{Interlinear|lang1=egy|lang2=egy|transl2=Egyp|italics1=yes|italics2=yes|glossing2=no|glossing3=yes
| {<hiero>d:D n:f</hiero>} <hiero>N19:n</hiero> <hiero>G38:f</hiero> <hiero>M23*L2:t*t</hiero> {<hiero>O1:F34 s:n</hiero>}
| [[wikt:dmḏj|d(m)ḏ.n]][[wikt:.f|.f]] {[[wikt:tꜣwj|tꜣwj]] [[wikt:n#Egyptian|n]]} [[wikt:zꜣ|zꜣ]][[wikt:.f|.f]] [[wikt:nswt-bjtj|nsw.t-bj.t(j)]] pr-jb.sn(j)
| unite.PRF.3SG<ref>Werning, Daniel A. (2008) "Aspect vs. Relative Tense, and the Typological Classification of the Ancient Egyptian ''sḏm.n⸗f''" in ''Lingua Aegyptia'' 16, p. 289.</ref>  [[tꜣwj|land.DUAL]].PREP son.3SG [[He of the Sedge and Bee|sedge-bee]] [[Pr (hieroglyph)|house]]-[[Ancient Egyptian concept of the soul#Jb .28heart.29|heart]].3PL
|"He has united [[tꜣwy|the Two Lands]] for his son, [[nsw-bjt|Dual King]] [[Seth-Peribsen|Peribsen]]."<ref name=":0">{{Harvcoltxt|Allen|2013|p=2}} citing Jochem Kahl, Markus Bretschneider, ''Frühägyptisches Wörterbuch'', Part 1 (2002), p. 229.</ref>
}}

However, there are multiple issues with the display:

  • The most glaring one is that the hieroglyphs (formatted using <hiero>...</hiero>) are not properly supported, being correctly shown once and then incorrectly shown again without formatting.
  • Smaller but still consequential issues are the failure to detect the boundaries of <ref>...</ref> and wikilinks in the glossing line, thereby failing to properly format 3SG and DUAL, respectively.

Additionally, attempting to identify the transliteration using either language code egy or script code Egyp results in an error about the transliteration scheme not being recognized, despite both being standard ways to use {{transl}}.

I have not investigated the cause of these issues, or any potential solutions, but I am happy to help with debugging and/or coding to get them fixed. —Gordon P. Hemsley 19:32, 21 July 2019 (UTC)Reply

References

  1. ^ Werning, Daniel A. (2008) "Aspect vs. Relative Tense, and the Typological Classification of the Ancient Egyptian sḏm.n⸗f" in Lingua Aegyptia 16, p. 289.
  2. ^ Allen (2013:2) citing Jochem Kahl, Markus Bretschneider, Frühägyptisches Wörterbuch, Part 1 (2002), p. 229.
Well, the module wasn't really meant to be used with text structured in such a complicated way. <hiero>...</hiero> outputs html tables and they break the template in several ways. The immediate issue of the repeated hieroglyphs is down to the fact that at the end of the interlinear display the module outputs a hidden <p>...</p> element containing the entirety of each line (that's for accessibility reasons). When the module tries to place the hierogyphs line (with all its tables) into a p element, it results in bad html, which gets corrected by moving the whole thing outside that element, and so the text gets exposed. This particular problem can be easily fixed by replacing div:tag("p") with div:tag("div") at line 787 of the current version of the module. However, the visible interlinear display itself uses <p>...</p> elements, so again the hieroglyphs fall out of that, with the result that they will slip out of the scope of any relevant parameters you've applied (like |lang1=). This can be fixed in a similar manner by making the interlinear display itself be rendered in <div>...</div> elements rather than <p>...</p> elements. I can't think off the top of my head of a reason why this could be a bad idea, but I'm not willing to make such a fundamental change without careful consideration.
The real problem is that hieroglyphs, or any other vertical scripts, can never be made to work well within {{interlinear}}. You might have noticed that the interlinear lines are vertically not well aligned: in the first word for example they reach a little bit lower than in the second word, that's because the first hieroglyph is a bit taller than the second one. I don't reckon there would be a way to fix that within the existing capabilities of the module. That's probably a case where the old method of doing glossed texts using tables actually works quite well. Of course, we could make the module detect hieroglyphs in the input and specifically format them using tables, but I think it's overall simpler if the few articles that need this just used wiki tables directly, as they do now.
As for the refs stopping the gloss from getting formatted, and the standard script identifier not getting recognised – these aren't supposed to be happening. I'll definitely have a look when I have a bit more time. Now, the gloss not getting recognised inside a wikilink: that's not a bug. The parser deliberately avoids doing anything to text within links, partly because it's assumed that a user who manually adds a link might have more specific ideas and so not be happy with the default behaviour, and partly because the risk of accidentally breaking something is greater than the benefit of saving a bit of typing time. You can just enclose "DUAL" in either {{sc}} or {{gcl}}. – Uanfala (talk) 22:00, 21 July 2019 (UTC)Reply
I've just fixed the ref issue [3]. – Uanfala (talk) 23:08, 21 July 2019 (UTC)Reply
I can look more deeply into the internals later on, but might CSS flexbox be useful for the vertical alignment issues? Surely support for vertical orthographies is something we should look into handling better (outside of the HTML issues caused by <hiero>...</hiero>), no? Also, is repeating the text a second time really the best way to handle accessibility of glossing? I'll spend some time getting more familiar with the output that's generated and see if there's a better way. —Gordon P. Hemsley 01:38, 22 July 2019 (UTC)Reply
Incidetally, <hiero>...</hiero> is documented at Help:WikiHiero syntax and mw:Extension:WikiHiero. —Gordon P. Hemsley 02:00, 22 July 2019 (UTC)Reply
You'll be very welcome to look more closely. I know next to nothing about html, and the current html output is largely copied from another site (as documented here). – Uanfala (talk) 06:34, 22 July 2019 (UTC)Reply
I hadn't heard of flexbox before. I take it that you're better acquainted with html than me, so I'll leave that for you: if you come up a way to support vertical text that won't have undesirable consequences, you're welcome to try it out. Personally, I don't see that as a priority, as it's a really niche use: apart from hieroglyphs, I can only think of the Old Uyghur and related scripts that go vertically. I have to admit though, that my initial misgivings about the potential of the html of <hiero>...</hiero> to break the template was misplaced. When the module processes wikitext, it sees the hieroglyphs not as html, but as strip markers, so it shouldn't have any more (or less) problems with them than it does with other extension tags, like <ref>...</ref>.
As for accessibility, this again is an area in which I know next to nothing, so if you have any suggestions, I'm all ears. Repeating each line in a hidden div was simply copied from the external site I used as a model. And I think it makes sense: in the the template's output, the elements go in the order word 1, gloss 1, word 2, gloss 2, etc. For people with screen readers, this makes the connection between each word and its gloss obvious. What it doesn't make obvious at all, is that the relations can go horizontally as well: word 1, word 2, etc, form a sentence.
Just adding that I've been thinking it might be time to switch to using CSS classes (using TemplateStyles), which should remove a lot of the clutter from the html output. – Uanfala (talk) 21:20, 23 July 2019 (UTC)Reply

It'd probably be good to wait until we've done the parameter work before we start on any of these major output changes, but I think we should figure out what the new output should ultimately look like before we start changing anything. I'm happy to take on the HTML and CSS aspects; I do have a lot of experience in those areas. As far as accessibility is concerned, I've been going back and forth between tables and flow content, trying to strike the right balance between semantic markup and display formatting. I haven't settled on a solution, and we'll probably need to iterate on this and solicit feedback, but I expect that duplicating the content is not the right way to go. (I'm not sure that having a screenreader read the content twice, once in each format, would not be the desired behavior, but perhaps I'm wrong.) In any case, we can come back to this later. —Gordon P. Hemsley 12:58, 24 July 2019 (UTC)Reply

Your help with the html will be greatly appreciated! I have to say that I wouln't mind even if fundamental aspects of it are re-examined; there certainly are other ways to format interlinear text: Glossa for instance uses <ol>...</ol> elements rather than divs (example). – Uanfala (talk) 14:23, 26 July 2019 (UTC)Reply


Proposed feature: nested numbering

edit

Current module Interlinear only provides a linear numbering feature. I wish to use this module to write some linguistics examples that are in a nested list form. For example, I can make something like this using a plain table:

(1) Jacaltec (Mayan), VAP (VSO)
a.

xa'

gave

ix

CL:she

te'

CL:the

hum

book

wet

to:me

an

1

xa' ix te' hum wet an

gave CL:she CL:the book to:me 1

"She gave the book to me."

b.

xahtoj

go:up

naj

CL:he

yiban

on

no'

CL:the

cheh

horse

xahtoj naj yiban no' cheh

go:up CL:he on CL:the horse

"He climbed on the horse."

But this cannot be done using numbering parameter in the module. It would be great if such feature is implemented to the module. However, I do not have an expertise in Lua language nor do I have the authorization to edit a module, thus, I am leaving a proposal here. Thanks! --Benzenekim (talk) 10:27, 31 May 2020 (UTC)Reply

Benzenekim, you could produce a similar result without using tables, and it's a lot simpler:
(1) Jacaltec (Mayan), VAP (VSO)

a.

xa'

gave

ix

CL:she

te'

CL:the

hum

book

wet

to:me

an

1

xa' ix te' hum wet an

gave CL:she CL:the book to:me 1

"She gave the book to me."

b.

xahtoj

go:up

naj

CL:he

yiban

on

no'

CL:the

cheh

horse

xahtoj naj yiban no' cheh

go:up CL:he on CL:the horse

"He climbed on the horse."

The trick is that the parameter accepts any string of characters, not just numbers, and that its name is |number= (not |numbering=, though I should probably add that as an alias; to be honest, I'm not completely happy with either parameter name, but haven't been able to come up with anything better). In the example, you can change the alignment by padding with {{nbsp}} where necessary, though there probably are more elegant ways of doing that. Does that work for you? If your proposal is to make a single invocation of the template capable of rendering several interlinearly glossed texts, then that is technically possible, but not practicable as it will add way too much complexity. – Uanfala (talk) 15:31, 31 May 2020 (UTC)Reply

@Uanfala: Thanks for the feedback! Although there will be some inconsistency if the article contains both nested and linear numberings, I think this is a feasible solution in general, at least for now. Thanks! – Benzenekim (talk) 07:13, 1 June 2020 (UTC)Reply
I would do it thus:
{{interlinear |number=(1) a.
|top= Jacaltec (Mayan), VAP (VSO)
|xa' ix te' hum wet an 
|gave CL:she CL:the book to:me 1
|"She gave the book to me."}}
{{interlinear |number={{hidden text|(1)}} b.
|xahtoj naj yiban no' cheh
|go:up CL:he on CL:the horse
|"He climbed on the horse."}}
(1) a.
Jacaltec (Mayan), VAP (VSO)

xa'

gave

ix

CL:she

te'

CL:the

hum

book

wet

to:me

an

1

xa' ix te' hum wet an

gave CL:she CL:the book to:me 1

"She gave the book to me."

(1) b.

xahtoj

go:up

naj

CL:he

yiban

on

no'

CL:the

cheh

horse

xahtoj naj yiban no' cheh

go:up CL:he on CL:the horse

"He climbed on the horse."

Eievie (talk) 04:51, 27 January 2024 (UTC)Reply
edit

I was trying to use {{gcl}} with three unnamed arguments — in the example on Woods Cree#Morphology I wanted {{gcl|TA|transitive animate|Algonquian languages#Grammatical_features}} — but instead of showing argument #2 ("transitive animate") as the tooltip, it was showing the page title from the link ("Algonquian languages"). This seems to be a bug: argument #2 is being ignored. Or is there some other way to do what I wanted? 4pq1injbok (talk) 10:17 22 January 2023 (UTC)

Thanks for noticing this. It's definitely a bug. It can be fixed by changing the order in which the html elements are built up in format_gloss(), that's between lines 299 and 334 of the current version of the module. However, that's a bit finicky to do right away, so I'll leave it until I set off working on the next version of the module. It's going to be at least a couple of months until then. In the meantime, the somewhat clumsy workaround that you can use is: [[Algonquian languages#Grammatical features|{{gcl|TA|transitive animate}}]]. – Uanfala (talk) 13:27, 22 January 2023 (UTC)Reply
Thanks, including for the workaround! 4pq1injbok (talk) 20:17, 24 January 2023 (UTC)Reply

Pages transcluding nonexistent sections

edit

Uanfala I have traced hundreds of pages in Category:Pages transcluding nonexistent sections to this module. is there any way we can check for the existence of the section before calling #section ? thank you! Frietjes (talk) 22:26, 13 March 2023 (UTC)Reply

Hmm, this category didn't exist when I was writing this module.. So, I think the error comes from line 522, when the module transcludes the page it's own looking for one particular WP:LST section (it needs that in order to implement the article-level custom abbreviations). I don't know much about how LST works, is there a way to make it perform the sort of check you're suggesting? – Uanfala (talk) 22:44, 13 March 2023 (UTC)Reply
Uanfala , something like this should work, assuming we don't run into any string processing limitations. is there a page where we could test it? or, do you have a better idea? Frietjes (talk) 15:52, 14 March 2023 (UTC)Reply
This breaks the functionality. Compare this page (which uses the module sandbox) with the standard version: you can see the errors by the sprinkling of red and by the message "Unknown glossing abbreviation(s)" at the end of each instance of the template. From a quick glance, I can't spot why this doesn't work. – Uanfala (talk) 19:25, 14 March 2023 (UTC)Reply
Uanfala, I fixed some typos, seems to work now? Frietjes (talk) 19:36, 14 March 2023 (UTC)Reply
Yep, that works. Feel free to merge the changes out of the sandbox. But I'm wondering, is that how things are going to be in the long run? Until now, the module could just load the section and then do things with it depending on whether it was empty or not. But now before loading the section, the module will have to first load the entire page and search its wikitext. The effect on performance seems to be small (I checked 15 times, and the average slowdown was 4%, probably not enough to make much of a difference at present), but it doesn't seem like the optimal long-term solution. Or is it that I'm using LST in ways it was not designed to be used? – Uanfala (talk) 20:07, 14 March 2023 (UTC)Reply
Uanfala, thanks, now merged! we could experiment with doing the LST using string processing, instead of doing the frame:preprocess which may be faster, since we are now loading the page contents (see, for example, Module:Transcluder). I could experiment with this if you think it would be useful. I don't think you are necessarily using LST in a bad way, it's just that we have a new tracking category to find actual bad uses, which we are unable to distinguish from false positives. Frietjes (talk) 20:22, 14 March 2023 (UTC)Reply
Thanks, but there's no need now, let's not complicate things. My hope is that if the use of LST here isn't completely unorthodox, then it would be possible in the future to filter out such false positives without having to change actual module code. – Uanfala (talk) 20:36, 14 March 2023 (UTC)Reply
Uanfala, sounds good, this most recent change has cut the number of entries in Pages transcluding nonexistent sections from about 1200 to about 350. next to fix is Template:Births and deaths by year for decade and a couple others. thanks again. Frietjes (talk) 20:42, 14 March 2023 (UTC)Reply

Right-to-left option

edit

When {{fs interlinear}} is used with languages that are written right-to-left, I would like an option to align the interlinear that way.

I tested it in Module:Interlinear/sandbox and I got this function working. It uses the param |RTL=yes. Here's 2 demos:

2.

𐤁𐤍

bn

bin

𐤌𐤋𐤊

mlk

milk

𐤕𐤁𐤍𐤕

tbnt

tabnīt

𐤌𐤋𐤊

mlk

milk

𐤑𐤃𐤍𐤌

ṣdnm

ṣīdōnīm

𐤃𐤁𐤓

dbr

dabar

𐤌𐤋𐤊

mlk

milk

𐤀𐤔𐤌𐤍𐤏𐤆𐤓

ʾšmnʿzr

ʾèšmūnʿazar

𐤌𐤋𐤊

mlk

milk

𐤑𐤃𐤍𐤌

ṣdnm

ṣīdōnīm

𐤋𐤀𐤌𐤓

lʾmr

līʾmōr

𐤍𐤂𐤆𐤋𐤕

ngzlt

nagzaltī

𐤁𐤍 𐤌𐤋𐤊 𐤕𐤁𐤍𐤕 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤃𐤁𐤓 𐤌𐤋𐤊 𐤀𐤔𐤌𐤍𐤏𐤆𐤓 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤋𐤀𐤌𐤓 𐤍𐤂𐤆𐤋𐤕

bn mlk tbnt mlk ṣdnm dbr mlk ʾšmnʿzr mlk ṣdnm lʾmr ngzlt

bin milk tabnīt milk ṣīdōnīm dabar milk ʾèšmūnʿazar milk ṣīdōnīm līʾmōr nagzaltī

son of king Tabnit, king of the Sidonians, king Eshmunazar, king of the Sidonians, said as follows: I was carried away

10.

𐠀𐠏𐠪𐠃𐠭𐠂

a-la-si-o-ta-i

'

'

𐠂𐠱𐠊𐠂

i-tu-ka-i

𐠀𐠏𐠪𐠃𐠭𐠂 ' 𐠂𐠱𐠊𐠂

a-la-si-o-ta-i ' i-tu-ka-i

Alasiotas, for luck.

Can someone sign off on this change before I go ahead and move it to the main Module:Interlinear? Eievie (talk) 06:15, 27 January 2024 (UTC)Reply

This conversation follows on from Talk:Sarcophagus of Eshmunazar II#Lining up the pieces
There are some issues raised in the linked section which are not addressed yet:
  1. The glyph order in each original-language word is still not reversed, which I would think is a major requirement for this change. My first attempt to implement this would be to call the lua string.reverse() method on each original-language line instead of whatever is currently reversing the word order. (On further investigation, not such a good idea after all!)
  2. All the parameter names in {{Interlinear}} are lower-case, so please use |rtl= or whatever instead of |RTL=
  3. The foreign-language line(s) are not highlighted as such (delimited by lang-specific html spans), even though the template invocation specifies |lang=
  4. The left- or right-alignment of the lines needs to be restricted to a box (html div) with the width of the longest line – this is particularly clear with the Cypriot example. That box does not itself need to be right-aligned on the page, in fact would probably be better left-aligned. I was hoping specifying |box=y would do the trick, but it does not (I'm not sure what determines the width of the box that is provided: update: the template seems not to play nicely with lists, a subsequent edit by Zinnober9 tidied the display up):
2.

𐤁𐤍

bn

bin

𐤌𐤋𐤊

mlk

milk

𐤕𐤁𐤍𐤕

tbnt

tabnīt

𐤌𐤋𐤊

mlk

milk

𐤑𐤃𐤍𐤌

ṣdnm

ṣīdōnīm

𐤃𐤁𐤓

dbr

dabar

𐤌𐤋𐤊

mlk

milk

𐤀𐤔𐤌𐤍𐤏𐤆𐤓

ʾšmnʿzr

ʾèšmūnʿazar

𐤌𐤋𐤊

mlk

milk

𐤑𐤃𐤍𐤌

ṣdnm

ṣīdōnīm

𐤋𐤀𐤌𐤓

lʾmr

līʾmōr

𐤍𐤂𐤆𐤋𐤕

ngzlt

nagzaltī

𐤁𐤍 𐤌𐤋𐤊 𐤕𐤁𐤍𐤕 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤃𐤁𐤓 𐤌𐤋𐤊 𐤀𐤔𐤌𐤍𐤏𐤆𐤓 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤋𐤀𐤌𐤓 𐤍𐤂𐤆𐤋𐤕

bn mlk tbnt mlk ṣdnm dbr mlk ʾšmnʿzr mlk ṣdnm lʾmr ngzlt

bin milk tabnīt milk ṣīdōnīm dabar milk ʾèšmūnʿazar milk ṣīdōnīm līʾmōr nagzaltī

son of king Tabnit, king of the Sidonians, king Eshmunazar, king of the Sidonians, said as follows: I was carried away

10.

𐠀𐠏𐠪𐠃𐠭𐠂

a-la-si-o-ta-i

'

'

𐠂𐠱𐠊𐠂

i-tu-ka-i

𐠀𐠏𐠪𐠃𐠭𐠂 ' 𐠂𐠱𐠊𐠂

a-la-si-o-ta-i ' i-tu-ka-i

Alasiotas, for luck.

-- Mirokado (talk) 14:55, 27 January 2024 (UTC)Reply
(additional suggestion removed) I was thinking about also displaying the original line in its original character order, but since the display here is column-based, that would probably be just confusing. -- Mirokado (talk) 20:19, 27 January 2024 (UTC)Reply
  1. What do you mean by "original-language word"? The Phoenician is already aligned correctly within the word (I compared it to this for reference, and it's the same). Do you mean the Latinization? Writing the Latinization right-to-left would... be pretty unusual. Do you really think that'd be valuable?
  2. I'll change the param case now
  3. That is not a thing in the normal left-to-right interlinear either. That might be a reasonable thing to add, but it's outside the scope of my current project.
  4. I can look into the logistics of how to do that, but making the template look like it's left-to-right, even though it's actually right-to-left, seems misleading. I think that the right-to-left template should look like its right-to-left somehow, so that people know how to interpret it.
Eievie (talk) 01:19, 28 January 2024 (UTC)Reply
  1. I'm preparing a response for this. See §Glyph order in words.
  2. Thanks, fine now.
  3. I agree this is a separate technical issue, so I will create a new section for it, see §Highlighting foreign language text as in template:lang.
  4. We can clarify that by making the enclosing box, say, 3em wider than the longest line. It is not the whole template output that should be right-aligned, but the lines within it, with the exception of the final translated line which is left-aligned. The box itself should be left-aligned on the page, at least by default. See §Box width, margin spacing.
Off for a late lunch now, more later. -- Mirokado (talk) 13:22, 29 January 2024 (UTC)Reply

Glyph order in words

edit

Hello again Eievie: by "original-language word" I mean 𐤀𐤔𐤌𐤍𐤏𐤆𐤓 (ʾšmnʿzr, ʾèšmūnʿazar, Eshmunazar) etc.

In Kata Biblon which you linked to (the table just above the match for "Phoenician and Greek transliteration") the transliterations are presented as currently in Sarcophagus of Eshmunazar II#English translation of the lid inscription, with whole sentences in columns for the stages of transcription, transliteration and translation. Here we are considering having successive lines for each stage, with the individual words of the inscription, transliteration and transcription in separate columns, followed by a line for the translation. This makes it easier to see how each word is being transformed (the columns cannot apply to the translation since word disposition may change). This already works nicely for languages written left-to-right, but it becomes confusing for right-to-left languages since the order of letters in the transliteration etc. is reversed compared to the order of the corresponding glyphs in the original language.

Here is a use case where following this glyph-to-letter correspondence is needed:

In Sarcophagus of Eshmunazar II#Inscriptions, an example of Aramaic usage is given with Hebrew script and the transliteration. I wanted to add the corresponding Phoenician script but it seemed difficult to identify the correspondence. This would have been much easier if the corresponding glyphs and letters were in the same order in vertically aligned words.

Hardly any of our readers will be able to read such inscriptions fluently in the original script, so making it easy to compare one representation with another should have priority in this sort of comparison table. I agree that writing the transcriptions etc back-to-front would not be helpful! Thus reversing the whole original inscription is appropriate, but only in the context of this sort of word split table.

It is probably also important to present the inscription in its original correct form too. Your third example in Talk:Sarcophagus of Eshmunazar II#Lining up the pieces goes some way towards showing that: the display problem there is the excessive misalignment of the first line. -- Mirokado (talk) 17:19, 29 January 2024 (UTC)Reply

I still don't understand get what you're asking for here. Within their joint block, the pieces (𐤀𐤔𐤌𐤍𐤏𐤆𐤓; ʾšmnʿzr; ʾèšmūnʿazar; Eshmunazar) can either be left-aligned or right-aligned. I'm happy to do whichever you want.
left-aligned right-aligned

𐤀𐤔𐤌𐤍𐤏𐤆𐤓

ʾšmnʿzr

ʾèšmūnʿazar

Eshmunazar

𐤀𐤔𐤌𐤍𐤏𐤆𐤓

ʾšmnʿzr

ʾèšmūnʿazar

Eshmunazar

Or are you asking to reverse the letters? I think that would be confusing for the majority of readers.
like this perhaps?

𐤀𐤔𐤌𐤍𐤏𐤆𐤓

rzʿnmšʾ

ʾèšmūnʿazar

Eshmunazar

Or do you mean how the words are ordered in the template? That part just takes care of itself.
{{#invoke:Interlinear/sandbox|interlinearise
|lang=phn |rtl=yes |number=2. |italics1=no |italics2=no |italics3=yes
|𐤁𐤍 𐤌𐤋𐤊 𐤕𐤁𐤍𐤕 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤃𐤁𐤓 𐤌𐤋𐤊 𐤀𐤔𐤌𐤍𐤏𐤆𐤓 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤋𐤀𐤌𐤓 𐤍𐤂𐤆𐤋𐤕
|bn mlk tbnt mlk ṣdnm dbr mlk ʾšmnʿzr mlk ṣdnm lʾmr ngzlt
|bin milk tabnīt milk ṣīdōnīm dabar milk ʾèšmūnʿazar milk ṣīdōnīm līʾmōr nagzaltī
|son of king Tabnit, king of the Sidonians, king Eshmunazar, king of the Sidonians, said as follows: I was carried away}}
2.

𐤁𐤍

bn

bin

𐤌𐤋𐤊

mlk

milk

𐤕𐤁𐤍𐤕

tbnt

tabnīt

𐤌𐤋𐤊

mlk

milk

𐤑𐤃𐤍𐤌

ṣdnm

ṣīdōnīm

𐤃𐤁𐤓

dbr

dabar

𐤌𐤋𐤊

mlk

milk

𐤀𐤔𐤌𐤍𐤏𐤆𐤓

ʾšmnʿzr

ʾèšmūnʿazar

𐤌𐤋𐤊

mlk

milk

𐤑𐤃𐤍𐤌

ṣdnm

ṣīdōnīm

𐤋𐤀𐤌𐤓

lʾmr

līʾmōr

𐤍𐤂𐤆𐤋𐤕

ngzlt

nagzaltī

𐤁𐤍 𐤌𐤋𐤊 𐤕𐤁𐤍𐤕 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤃𐤁𐤓 𐤌𐤋𐤊 𐤀𐤔𐤌𐤍𐤏𐤆𐤓 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤋𐤀𐤌𐤓 𐤍𐤂𐤆𐤋𐤕

bn mlk tbnt mlk ṣdnm dbr mlk ʾšmnʿzr mlk ṣdnm lʾmr ngzlt

bin milk tabnīt milk ṣīdōnīm dabar milk ʾèšmūnʿazar milk ṣīdōnīm līʾmōr nagzaltī

son of king Tabnit, king of the Sidonians, king Eshmunazar, king of the Sidonians, said as follows: I was carried away

The "𐤁𐤍 𐤌𐤋𐤊" line is written right-to-left in the template, and the "bn mlk" line is written left-to-right, and the template just takes care of it and pairs the pieces up correctly regardless.
Eievie (talk) 03:04, 30 January 2024 (UTC)Reply
Thanks again for your response. I have now investigated the template a bit more. If we reduce the width of the window, we can see that the interlinear display flows at smaller widths, thus supporting rather longer texts that in any of the examples we have been using. That means that what I have been thinking of would not work as well as I had hoped, so I have now struck point one above. -- Mirokado (talk) 22:44, 30 January 2024 (UTC)Reply
I have looked at a couple of glossing rules (Leipzig, Humboldt) and they both specify left-alignment for the interlinear items. -- Mirokado (talk) 22:44, 30 January 2024 (UTC)Reply
They say that, but they also categorically don't mention right-to-left languages, so I'm not sure that's applicable here. Eievie (talk) 01:01, 31 January 2024 (UTC)Reply
Basically, I think something about the right-to-left version should visually signal that this is right-to-left. If the overall gloss hugs the left edge of the page (per the table thing), then I think the words should align right within the blocks. Or if not that, then something should align right to make it visually clear. Eievie (talk) 01:21, 31 January 2024 (UTC)Reply
Yes, that is a good point. It is particularly noticeable in the Cypriot example. So please go with right-aligned words within the blocks. -- Mirokado (talk) 11:58, 1 February 2024 (UTC)Reply

Box width, margin spacing

edit

In various examples already provided for this change, some lines which are not word-split for the table columns are separated from the table by their alignment to the page margins. This impairs readability and is not good graphic design. It should be corrected by an enclosing box (or whatever depending on implementation) whose width is related to the width of the main table. It would be fine to have left- and/or right-padding for the table to provide a small (say 3em) offset for the margins of the lines outside the table. -- Mirokado (talk) 17:19, 29 January 2024 (UTC)Reply

Can you provide an example? I can't quite imagine what you mean by "some lines which are not word-split". Are you referring to Phoenician examples that use dots, rather than spaces, as word delimitators?
As for box width:
  1. Right now the box has the default <div> property: display: block; which takes 100% width.
  2. The obvious change would be display: inline-block;, but that would cause issues elsewhere. It would mean multiple narrow interlinear next to each other would stack up like this:
    (1) a.

    1SG

    kem

    see

    men

    child

    kem men

    1SG see child

    'I saw the child'

    (1) b.

    1SG

    ke?

    NEG

    jen

    see

    men

    child

    ke? jen men

    1SG NEG see child

    'I did not see the child'

    (1) c.

    1SG

    do

    PAST.REC

    jen

    see

    men

    child

    do jen men

    1SG PAST.REC see child

    'I just saw the child'

    (1) d.

    1SG

    ke

    ??

    njen

    see

    men

    child

    ke njen men

    1SG ?? see child

    'It was me who saw the child'

  3. display: table; appears to be a pretty good option right now. Not 100% width, but also not stackable because of the narrowness either.
    10.

    𐠀𐠏𐠪𐠃𐠭𐠂

    a-la-si-o-ta-i

    '

    '

    𐠂𐠱𐠊𐠂

    i-tu-ka-i

    𐠀𐠏𐠪𐠃𐠭𐠂 ' 𐠂𐠱𐠊𐠂

    a-la-si-o-ta-i ' i-tu-ka-i

    Alasiotas, for luck.

    2.

    𐤁𐤍

    bn

    bin

    𐤌𐤋𐤊

    mlk

    milk

    𐤕𐤁𐤍𐤕

    tbnt

    tabnīt

    𐤌𐤋𐤊

    mlk

    milk

    𐤑𐤃𐤍𐤌

    ṣdnm

    ṣīdōnīm

    𐤃𐤁𐤓

    dbr

    dabar

    𐤌𐤋𐤊

    mlk

    milk

    𐤀𐤔𐤌𐤍𐤏𐤆𐤓

    ʾšmnʿzr

    ʾèšmūnʿazar

    𐤌𐤋𐤊

    mlk

    milk

    𐤑𐤃𐤍𐤌

    ṣdnm

    ṣīdōnīm

    𐤋𐤀𐤌𐤓

    lʾmr

    līʾmōr

    𐤍𐤂𐤆𐤋𐤕

    ngzlt

    nagzaltī

    𐤁𐤍 𐤌𐤋𐤊 𐤕𐤁𐤍𐤕 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤃𐤁𐤓 𐤌𐤋𐤊 𐤀𐤔𐤌𐤍𐤏𐤆𐤓 𐤌𐤋𐤊 𐤑𐤃𐤍𐤌 𐤋𐤀𐤌𐤓 𐤍𐤂𐤆𐤋𐤕

    bn mlk tbnt mlk ṣdnm dbr mlk ʾšmnʿzr mlk ṣdnm lʾmr ngzlt

    bin milk tabnīt milk ṣīdōnīm dabar milk ʾèšmūnʿazar milk ṣīdōnīm līʾmōr nagzaltī

    son of king Tabnit, king of the Sidonians, king Eshmunazar, king of the Sidonians, said as follows: I was carried away

Eievie (talk) 17:09, 30 January 2024 (UTC)Reply
In your original examples, you had a top line with the original script, and all examples have the bottom line with the English translation. Depending on the various alignment choices, one or other of these could end up separated from the interlinear lines which are shorter than the margin separation for a wide screen (less noticeable on a narrow screen).
Your final example here using display: table; is what I was looking for. It behaves nicely as the window is made narrower. Well done! If you are able to implement that (absent any unexpected problems of course) I can strike this point too. -- Mirokado (talk) 22:44, 30 January 2024 (UTC)Reply

Highlighting foreign language text as in template:lang

edit

I think it is desirable to apply the same markup to the foreign script in this template as is applied by {{lang}}. In my view this would be necessary if we are to use this template in articles where all the foreign script is already presented via the lang template(s). The relevant language can already be specified by |lang=, so not providing this markup may go against a user's expectations. -- Mirokado (talk) 17:19, 29 January 2024 (UTC)Reply

I think this should go beyond just {{lang}}, to a broader feature where we can wrap each word of   line in   template. It could default to:
but alterable with additional parameters, just as the default italics and glossing can be altered. Eievie (talk) 17:18, 30 January 2024 (UTC)Reply
Yes, by all means consider a broader feature. You are right that {{lang}} markup is only relevant for the original-language line. As far as I can see, lang should be used for line 1 in both the above cases when that line is in a particular language. -- Mirokado (talk) 22:58, 30 January 2024 (UTC)Reply

Template overhaul

edit

In the file Module:Interlinear/sandbox2, I have been working on a substantially changed version of the Lua code. Testing/examples of it can be seen on Template:Interlinear/sandbox/testcases.

The main categories of changes are:

  1. Moving as much of the CSS code as possible out of the Lua file and into the file ../styles.css. Having the CSS code in one place and controlled by classes (rather than style=) makes it cleaner and easier to alter.
  2. Adding the right-to-left |rtl=yes feature
  3. (in progress) Integrating the use of other Wikipedia templates into interlinear glosses, namely: {{script}}, {{lang}}, {{transliteration}}, {{IPA}}. Ideally there would be a parameter along the same lines as |italics =yes — perhaps |wrapper = — which would allow a user to specify a template to apply to each word of a line.
  4. Creating a |smallcaps=yes parameter, as it appears that many people like to format transliteration of inscriptions that way (particularly the Phoenician and Ogham ones)
  5. (to do) Clean up the glossing code somehow. Move it to a second module, which is called upon? Not sure what yet, but right now it's the least readable part of the file and it's driving me slightly crazy. Within the broader category of integrating other templates into it, I'm thinking about some form of creating a separate {{gcl}} template or module which is called upon.

Eievie (talk) 17:56, 1 February 2024 (UTC)Reply