Module talk:headword

Latest comment: 5 months ago by This, that and the other in topic нямам

Edit request edit

[1] (it is tested) --Z 14:22, 26 April 2013 (UTC)Reply

Not done until it is discussed more widely and the issues with the current template have been worked out. This edit affects thousands of pages, and I currently have no guarantee that it will work. "it is tested" is not good enough. —CodeCat 14:28, 26 April 2013 (UTC)Reply
But why did you implemented your own change which, as you said, has issues and affected many pages without any disccussion? Btw, I intentionally created it as a subpage of the module so that other people can also work on it. --Z 14:40, 26 April 2013 (UTC)Reply
The difference is that I am working to fix all of those issues right at this moment. And what benefit does allowing many people to work on such a critical template have? The fact that you continue to make changes to Module:links makes me very hesitant to use that module. I would rather use something that is stable, mature, well-understood, and not subject to many revisions. That is one of the reasons why I don't feel comfortable making your changes, they change too much and I don't have any guarantees that they will not break something badly. With code that I write myself I do have that guarantee to a significant degree, because I do understand the code that I write. The fact that even my own code still causes problems should be enough of a reason to reject someone else's code that I don't know anything about. —CodeCat 14:50, 26 April 2013 (UTC)Reply
Ok, I see. Except this part: "I would rather use something that is stable, mature, well-understood, and not subject to many revisions. ... I don't have any guarantees that they will not break something badly", Module:links is tested and is widely used. --Z 15:16, 26 April 2013 (UTC)Reply

Italicized Tamil when it shouldn't be edit

E.g. on அக்கினி. Also when in {{l}}. --Ivan Štambuk (talk) 02:19, 8 August 2013 (UTC)Reply

I don't see italics on that page anywhere...? —CodeCat 11:01, 8 August 2013 (UTC)Reply
In the headword line, I've tried in three different browsers and in shows in italics. --Ivan Štambuk (talk) 18:28, 8 August 2013 (UTC)Reply
The headword line displays in regular style for me. Maybe you need to refresh your CSS? If you have Firefox, can you go to the page and press ctrl+shift+I to open the document inspector. Then click on the headword, and see what styles it assigns to it in the bottom right. —CodeCat 20:11, 8 August 2013 (UTC)Reply
Italic for me as well. --Vahag (talk) 20:51, 8 August 2013 (UTC)Reply
Normal for me. --Z 21:07, 8 August 2013 (UTC)Reply
I'm not sure, but it could be a Windows-only problem. --Ivan Štambuk (talk) 06:13, 9 August 2013 (UTC)Reply

Overriding manual translit edit

Overriding manual transliteration does not work for this module. --Vahag (talk) 17:02, 30 August 2013 (UTC)Reply

It is broken again. --Vahag (talk) 12:41, 13 January 2014 (UTC)Reply
Where is it broken? —CodeCat 14:44, 13 January 2014 (UTC)Reply
I noticed override isn't working here. {{t}} and {{l}} are fine. --Vahag (talk) 15:00, 13 January 2014 (UTC)Reply
I'm not sure what's wrong with the entry. Is the transliteration not correct? —CodeCat 15:06, 13 January 2014 (UTC)Reply
The manual transliteration is not correct. It uses a deprecated scheme. There are thousands such entries, found in Category:Terms with manual transliterations different from the automated ones/hy. Overriding the old manual transliteration is necessary here. Until recently {{head}} used to do that and put the entry into the category I mentioned. But now it does neither. --Vahag (talk) 15:18, 13 January 2014 (UTC)Reply
I don't think it was done by a recent change. I'm looking through older revisions of the module but I don't see any code that could override it. I don't think it's actually broken, it was just never done in the first place. —CodeCat 16:23, 13 January 2014 (UTC)Reply
Hmmm, now that I think about it, maybe it was never implemented. {{hy-noun}} “overrides” manual transliteration not because it's a feature of {{head}}, but because I used to supply transliteration as its first parameter and {{head}} requires tr= for transliteration, so my wrong transliterations are effectively ignored. --Vahag (talk) 17:19, 13 January 2014 (UTC)Reply
If we want this overriding to work, we really need to put it somewhere that all templates and modules can/will use it. But it's kind of kludgey right now, there's a list of languages in the module itself... not really the nicest way to do it. I do have some ideas for now to improve it, but it would need to wait a bit until some current changes have been fully done. We're in the middle of a reorganisation with Module:languages right now. —CodeCat 17:23, 13 January 2014 (UTC)Reply
The current list of languages with override_translit is here: Module:links. --Anatoli (обсудить/вклад) 21:57, 13 January 2014 (UTC)Reply
I think once the changes have settled down a bit, we can look at how to incorporate transliterations into Module:languages more directly. Then we wouldn't need the "transliterate" function in Module:script utilities anymore. —CodeCat 22:42, 13 January 2014 (UTC)Reply

Variants of an inflection edit

Is there any support for variants of one inflection? I.e. (neuter variant1/variant2). --Njardarlogar (talk) 13:16, 1 December 2013 (UTC)Reply

You can use "or", like {{head}} allows. —CodeCat 14:32, 1 December 2013 (UTC)Reply
1 extra character versus 4. If there are e.g. 4 inflections with a variant, that's 16 extra characters compared to 4. Not ideal. --Njardarlogar (talk) 15:03, 1 December 2013 (UTC)Reply
Then show four inflections with variants in a declension table below. The headword line isn't made of rubber. --Vahag (talk) 15:08, 1 December 2013 (UTC)Reply
Which is why I want to limit the number of extra characters: so that the information will fit. Tables are more complicated to make and maintain; and they are unnecessary for languages with limited inflection. --Njardarlogar (talk) 15:39, 1 December 2013 (UTC)Reply
The syntax {'neuter', '[[variant1]]/[[variant2]]'} seems to work, so that is an alternative. --Njardarlogar (talk) 15:42, 1 December 2013 (UTC)Reply
Just because it works doesn't mean it's desirable to do it... —CodeCat 16:23, 1 December 2013 (UTC)Reply
Is it likely to become invalid syntax in the future? If not, I don't see the big issue. Nope, it's not desirable. --Njardarlogar (talk) 16:41, 1 December 2013 (UTC)Reply
It's not likely to become invalid, but it does obscure the semantics (in template/module terms). That is, the module itself isn't able to "see" that there are really two words there, unless it decides to piece apart the whole thing (splitting the [[ ]] and / ). For the short term it's not a huge problem, but it can give problems in the long term if we ever want to change things. For example, we could decide, later on, that we want to show something else instead of "or". If you use "or" now, then that's easy to do, but not when you put it all into one parameter. Being more explicit about what you mean and not so explicit about what you want to see is good practice in templates/modules, as well as in web pages generally. —CodeCat 16:55, 1 December 2013 (UTC)Reply
What about adding support for arrays? Are slashes frowned upon? I noted that the documentation already talks about using links in the argument (the voorbeelden example), so introducing two of them doesn't seem that terribly revolutionary; even if not the same. --Njardarlogar (talk) 13:10, 7 December 2013 (UTC)Reply
I've thought of using arrays/tables but they're not supported in templates, so there would be no gain in that respect anyway. You'd still need to use "or" to signal to {{head}} that you want both terms to be in the same array. —CodeCat 14:25, 7 December 2013 (UTC)Reply

Sorting edit

How do you set the sorting key in templates? E.g {{vi-noun}} or {{cmn-noun}}, so that entries don't get into Category:Sort key tracking/needed, set in Module:utilities? --Anatoli (обсудить/вклад) 04:09, 3 April 2014 (UTC)Reply

@Atitarev That category is added if the sort key was specified, but it didn't match the automatically generated one. I don't know if we still need it though... the main purpose was so that we could find out which languages still needed auto-generation rules, and which entries had sort= parameters that needed to be removed. —CodeCat 12:50, 8 April 2014 (UTC)Reply
{{cmn-noun}} should sort Mandarin nouns by "pint" (hopefully), as it says on the first line, {{vi-noun}} by the term itself, if it's in Roman script or the Roman spelling of the Han character term. How can the automatically generated sort key be changed, is any change required to the templates? --Anatoli (обсудить/вклад) 13:32, 8 April 2014 (UTC)Reply
{{head}} has a sort= parameter, so if the templates use {{head}}, then they can just use that. —CodeCat 14:01, 8 April 2014 (UTC)Reply

linking to same page when it's an inflected form edit

At [[bonefish]], {{en-noun|bonefish|bonefishes}} displays

''plural'' <span class="form-of lang-en plural-form-of"><b class="Latn" lang="en"><strong class="selflink">bonefish</strong></b></span>

rather than the expected

''plural'' <span class="form-of lang-en plural-form-of"><b class="Latn" lang="en">bonefish</b></span>

as it used to. I guess line 120 here —

part = m_links.full_link(not parts.nolink and part.term or nil, part.alt or (parts.nolink and part.term or nil), lang, part.sc, "bold", part.id, {genders = part.genders, tr = "-"}, FULLPAGENAME)

— should be modified somehow to fix this. Or maybe something else should.​—msh210 (talk) 05:44, 8 April 2014 (UTC)Reply

The "selflink" part is added by the software itself. It's done whenever someone links to the current page, like here: Module talk:headword. —CodeCat 12:48, 8 April 2014 (UTC)Reply
I was aware of that. But that's only if {{en-noun}} generates a link, which it shouldn't and didn't use to.​—msh210 (talk) 17:39, 8 April 2014 (UTC)Reply
I'm not sure if I understand. I don't see a link anywhere in the code you showed above. In fact the wiki software is explicitly preventing a link to the same page from being created. —CodeCat 17:41, 8 April 2014 (UTC)Reply
The <strong class="selflink">bonefish</strong> is the effect of the template's presenting the plural form as a wikilink: the software realizes the link would be to the same page and makes it strong (boldfaced) instead. That's what I meant by "{{en-noun}} generates a link": it generates a link for the plural form, which, in this case because the plural form matches the pagename, it shouldn't and the software converts to boldface. (Have some Madeira, m'dear.)​—msh210 (talk) 03:56, 9 April 2014 (UTC)Reply
{{en-noun}} always used to do this. --WikiTiki89 18:20, 8 April 2014 (UTC)Reply
My memory misserves me! Looking at [2] at least, it seems you're right. Thanks for the correction. So I'm wrong that the template's doing different form what it used to: but I think it should. I suppose that's a discussion for the BP, though, not here.​—msh210 (talk) 03:56, 9 April 2014 (UTC)Reply

Continued discussion at [[Wiktionary:Beer parlour/2014/June#boldfaced forms of invariant lemmata in headword lines]].​—msh210 (talk) 17:39, 11 June 2014 (UTC)Reply

I am not sure if the discussion in the beer parlour reached any conclusion. I tried a simple fix to avoid a bolded selflink. I think it works fine. --Vriullop (talk) 14:18, 29 July 2014 (UTC)Reply
The discussion did reach a conclusion. The solution is to modify the CSS, not the module. The module is fine. —CodeCat 14:26, 29 July 2014 (UTC)Reply
Sorry, I was confused because it has not been done till right now. Thanks. --Vriullop (talk) 15:27, 29 July 2014 (UTC)Reply
@Vriullop Is it fixed now? —CodeCat 15:52, 29 July 2014 (UTC)Reply
Yes. The two words of bonefish are identical now with Firefox. Before, the second one was extra bolded. --Vriullop (talk) 18:31, 29 July 2014 (UTC)Reply

"transliteration needed" for Serbo-Croatian Cyrillic headwords edit

This obnoxious message now appears in the headwords, but it shouldn't (e.g. on имати, оданост). --Ivan Štambuk (talk) 15:48, 6 October 2014 (UTC)Reply

See the GP discussion. —CodeCat 15:50, 6 October 2014 (UTC)Reply

Duplicates edit

Would it be natural for this module to filter out duplicates? Right now, it happily displays

  • fruppic tense WADIWU or WADIWU

rather than

  • fruppic tense WADIWU.

--Njardarlogar (talk) 10:50, 18 December 2014 (UTC)Reply

th edit

Please add

["th"] = true,

to notranslit to leave transliteration blank in Thai headword. --Octahedron80 (talk) 06:10, 24 February 2016 (UTC)Reply

I've added but it's still attempting to autotransliterate. See the current strange behaviour at สร้าง. The pronunciation section shows the correct transliteration - "sâang", the headword shows "srâang" (it's wrong). --Anatoli T. (обсудить/вклад) 06:30, 24 February 2016 (UTC)Reply
Problem gone. If you still see on some page, purge it. :) --Octahedron80 (talk) 06:46, 24 February 2016 (UTC)Reply

InTG WIKTIONARY edit

Can you create this module in tg wiktionary. And another ru modules. Please :-). And thanks заранее ToJack (talk) 13:52, 3 February 2017 (UTC)Reply

Edit request edit

@Erutuon When the edit request for Module:links has been done, please remove lines 287-289, and replace line 281 with:

				tr = part.translit or (not (parts.enable_auto_translit or data.inflections.enable_auto_translit) and "-" or nil),
				accel = parts.accel or partaccel,

CodeCat 12:50, 20 August 2017 (UTC)Reply

  DoneEru·tuon 18:10, 20 August 2017 (UTC)Reply

Script tags and redundant scripts edit

@Erutuon I notice that in diff you added code that fills in data.sc if it's nil. However, this very same code is already in the preprocess function. One of them should go, but which?

The reason I ask is because I traced a lot of redundant instances of sc= to here. It turns out that the module automatically puts data.sc on the inflections as well. Perhaps this is what we want; if someone specifies the script of the headword then you can probably assume the inflections will also be in that script. The alternative would be having to provide sc= on each inflection as well. This may or may not be desirable. Regardless, a problem arises because the headword script is applied to inflections after the headword script is autodetected. This means that for e.g. an English noun, first the headword is determined to be Latn by autodetection, and then Latn is passed to Module:links for every plural form. That module then scoffs because it's being given a script that it can autodetect.

I can think of two possible solutions for this, depending on which direction we want to go in:

  • If we don't want headword script to be automatically applied to inflections, then the solution is fairly simple. But we'll have to make sure this change doesn't break entries which rely on it, and provide fNsc= parameters as necessary.
  • If we do want headword script to be automatically applied to inflections, then we need to do so only if the headword script is actually provided in data.sc. This would need to be done before the autodetection, which sets data.sc regardless. If data.sc is actually provided, then the module should also apply this to the .sc of every inflection part individually in the preprocessing stage.

Rua (mew) 12:15, 8 January 2018 (UTC)Reply

@Rua: It is certainly complicated tracing the instances of scripts being passed to Module:links.
I think it may be a better use of server resources to expect all inflections in a headword to share the script of the lemma form, unless indicated otherwise. But then again, maybe it doesn't save all that server time and memory. There are currently 281 languages with two or more scripts, 72 with three or more. That means only for these languages does findBestScript do pattern-matching; if there's just one script, it will be quickly returned. And in many cases of the 72 languages, a script will be returned after just one pattern-matching.
The script-getting in the preprocess function seems to happen after the script-getting in the full_headword function, so the former is clearly unnecessary. However, I'm still trying to understand the logic of the module and of what you're trying to do, so I'm not confident enough to say any more. — Eru·tuon 21:57, 8 January 2018 (UTC)Reply

ts= param edit

Thanks @DTLHS and @Erutuon for adding |ts=! --Victar (talk) 01:18, 17 March 2018 (UTC)Reply

@DTLHS, Erutuon: So, I guess I should have asked for this before, but f=ts? :D*i̯óh₁n̥C[5] 23:28, 17 March 2018 (UTC)Reply
Nope. Again with the vanishing parameters. This time it doesn't seem possible to work around the issue by reordering the table. DTLHS (talk) 23:34, 17 March 2018 (UTC)Reply

Lua error found on 祢 page edit

I found an error on 's page reading:

Lua error in Module:headword at line 548: malformed pattern (missing ']')

Can this be fixed please? Thanks. EDIT: Also found this error on [[你}]]. Fluoromethyl (talk) 21:10, 28 November 2020 (UTC)Reply

Ah I see. Thanks for clearing that up. Fluoromethyl (talk) 10:39, 29 November 2020 (UTC)Reply

heads up edit

@Theknightwho Hi, I see you just made a change to this module. Do you have any more changes planned in the next day or so? I'm going to be rewriting this module so the `data.heads` table can be an array of objects rather than always an array of strings. Preferably, transliterations, transcriptions and other headword-specific properties all go into this table rather than into separate arrays, as currently. This is so I can support qualifiers and such things attached to individual headwords in a clean fashion. The preprocess() function will gather stuff into headword objects if not already in that format, and code to format headword objects will be partly shared with format_inflection_parts(). Let me know if these changes will interfere with anything you have planned. BTW I see a ton of tracking code in this module and I doubt it all needs to be there. Is any of it being used by you? If not I may start selectively removing stuff that doesn't look important. Benwing2 (talk) 07:03, 4 March 2023 (UTC)Reply

@Benwing2 Thanks for the heads up. The only thing on my radar at the moment is to add the magic characters that have already been added to Module:links, but it's not urgent - I probably won't get round to it for a while. Theknightwho (talk) 07:06, 4 March 2023 (UTC)Reply
@Theknightwho Hi. You added some code in full_headword() lines 588-592 that seems wrong; if `heads` is left nil, you substitute pagename which disables the default multiword linking that happens around line 160 in preprocess(). It "works" in most cases currently because the passed-in value for `data.heads` is usually a zero-length table, which your code leaves alone; but I'm not sure if this was intentional on your part. Also the code you added in lines 599-607 looks ugly and I don't understand it. Can you explain what it's supposed to do? I take it you are allowing per-headword script specification but there has to be a better way to do this; in particular the change I mention just above should make this a lot cleaner. Also what code currently relies on being able to specify an array of script objects in `data.sc` in `full_headword`, since I want to remove this functionality and move it into headword objects? Thanks! Benwing2 (talk) 07:54, 4 March 2023 (UTC)Reply
@Benwing2 I'll have to go over this to remind myself of what I was doing and why - will get back to you shortly. Theknightwho (talk) 08:46, 4 March 2023 (UTC)Reply

Transcription slashes edit

@Benwing Your recent rewrite (diff) seems to have made it so transcriptions are no longer in slashes (eg. Sumerian 𒂍𒃲). Doesn't look intentional, the slashes still appear in mentions (eg. Akkadian ēkallum). Catonif (talk) 11:50, 24 March 2023 (UTC)Reply

@Benwing2 sorry wrong ping Catonif (talk) 22:10, 24 March 2023 (UTC)Reply
@Catonif Should be fixed. BTW if you pinged me recently on other topics, apologies for not responding, I've been a bit overwhelmed with pings and need to sit down and go through the backlog. Benwing2 (talk) 22:50, 24 March 2023 (UTC)Reply
@Benwing2 Thank you, and take your time. We wouldn't want to wear you down. Nte sciupà. :) Catonif (talk) 23:03, 24 March 2023 (UTC)Reply

нямам edit

@Benwing2 It certainly looks better with the comma than without. However, in this entry, the lemma gloss is a very long way from the lemma (separated by the transliteration and aspect information), such that it's not totally clear that the lemma gloss even pertains to the lemma itself. It could be misinterpreted as saying that the verb is defective and only exists in this form. Not sure what to do. Perhaps lemma glosses are not required in situations where the headword line doesn't contain any other forms? This, that and the other (talk) 22:48, 16 November 2023 (UTC)Reply

@This, that and the other I wonder if we should put the lemma gloss directly after the lemma, before the translit and gender/aspect. Try modifying line 96 of Module:bg-headword as follows:
	return require("Module:User:Benwing2/headword").full_headword(data)

and then, without saving, preview нямам. This will let you see the lemma gloss before the translit; I think it looks fine that way, and it won't make any difference for Latin, where there's no translit or aspect. Benwing2 (talk) 22:56, 16 November 2023 (UTC)Reply

@Benwing2 Hmm, I wonder if it should come after the translit but before the grammatical info? The lemma and its translit feel like a "unit" to me. Maybe just put it before the translit for now, and we'll see if anyone complains. This, that and the other (talk) 23:24, 16 November 2023 (UTC)Reply
@This, that and the other Try it now; I put the lemma gloss between the translit and gender, with a comma between lemma gloss and gender if both exist. Benwing2 (talk) 23:30, 16 November 2023 (UTC)Reply
@Benwing2 looks good to me. This, that and the other (talk) 23:51, 16 November 2023 (UTC)Reply
Return to "headword" page.