Module talk:Wikt-lang
This is the talk page for discussing improvements to the Wikt-lang module. |
|
Archives: 1Auto-archiving period: 12 months |
This module does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
|
To help centralize discussions and keep related topics together, Template talk:wikt-lang and Template talk:wt redirect here. |
On 9 July 2024, it was proposed that this page be moved from Module:Language to Module:Wikt-lang. The result of the discussion was moved. |
Italicisation of Halkomelem
edit- This discussion moved to Template talk:Lang/Archive 7#Italicisation of Halkomelem, as it pertains to
{{lang}}
. — Preceding unsigned comment added by Erutuon (talk • contribs) 17:13, 29 June 2018 (UTC)
missing data?
editAm I mistaken, or should every language tag that is listed in the ["languages"]
table have both of ["name"]
and ["article"]
entries? If that is so then:
these are missing ["name"]
:
be
– Belarusianse
– Northern Samish
– Serbo-Croatianuk
– Ukrainiangoh
– Old High Germanjbo
– Lojban
these are missing ["article"]
:
ab
– Abkhazae
– Avestanav
– Avarff
– Fulaha
– Hausalt
– Lithuanianoj
– Ojibwerw
– Kinyarwanda, wikt: Rwanda-Rundise
– Northern Samisl
– Sloveneaaq
– Eastern Abnaki, wikt: Penobscotbua
– Buryategy
– Ancient Egyptian, wikt: Egyptianfrp
– Arpitangml
– Middle Low Germangoh
– Old High Germangsw
– Alemannic Germangrt
– Garojbo
– Lojbanmoe
– Innu, wikt: Montagnaisodt
– Old Dutchoge
– Old Georgianosx
– Old Saxoncel-pro
– Error: unrecognized language tag: cel-pro, wikt: Proto-Celticcel-x-proto
– Proto-Celticgmw-ecg
– Error: unrecognized language tag: gmw-ecg, wikt: East Central Germannds-de
– Low German, wikt: German Low Germansla-pro
– Error: unrecognized language tag: sla-pro, wikt: Proto-Slavic
In the above list the language names are the names that Module:Lang associates with the language tag. When a second name is listed, Module:Lang and Wiktionary definitions of the language tag disagree. In the case of the IETF-like language tags, Module:lang does not support extlangs and the extlangs that Wiktionary uses are not defined in the IANA language-subtag-registry file. Wiktionary names used above were taken from one of:
- wikt:Module:languages/data/3/a
- wikt:Module:languages/data/3/b
- wikt:Module:languages/data/3/e
- wikt:Module:languages/data/3/f
- wikt:Module:languages/data/3/g
- wikt:Module:languages/data/3/j
- wikt:Module:languages/data/3/m
- wikt:Module:languages/data/3/o
- wikt:Module:languages/data/exceptional
Am I mistaken? Is there a reason that these language tags do not have both of ["name"]
and ["article"]
?
—Trappist the monk (talk) 15:50, 14 December 2023 (UTC)
- @Editor Erutuon: you are (apparently) the original author of this module. Do you have an answer for my questions?
- —Trappist the monk (talk) 20:32, 17 December 2023 (UTC)
- It's been a long time since I looked at this module. It doesn't currently use the
article
field in any code that can be invoked by a template.makeLinkedName
uses thearticle
field, but it's orphaned and apparently I never tested it, because it would give a "tried to concatenate nil" error for language codes that don't have anarticle
field or don't have aWikipedia_name
orname
field. I think I meant to use it in another invokable module function that would prepend the language name like{{lang-fr}}
does, and never got around it. But it would probably be better to have Module:lang generate that language name. So for now thearticle
field is unnecessary. - The
name
field is used to specify the canonical name (the name of the language used in level-2 headers in Wiktionary entries). If I remember right, in the code that is invoked by templates, it is only needed whenmw.language.fetchLanguageName(languageCode, 'en')
doesn't return the canonical name. Thus,be
doesn't have aname
field becausemw.language.fetchLanguageName('be', 'en')
returnsBelarusian
, the canonical name; butab
has aname
field with the canonical nameAbkhaz
becausemw.language.fetchLanguageName('ab', 'en')
returnsAbkhazian
andaaq
hasAbnaki
becausemw.language.fetchLanguageName('aaq', 'en')
returns nil. - The
name
fields are incomplete because I hadn't worked out how to fully populate the list of idiosyncratic Wiktionary language names and keep it up to date. There's no way for Lua modules on Wikipedia to access data modules on Wiktionary, so unless someone manually copies modules from Wiktionary to Wikipedia every time there is a change, the syncing would have to be done with JavaScript or an off-wiki script. - We don't use real extlang subtags on Wiktionary or IETF language tags, but only use idiosyncratic codes identifying languages that can have entries, or language families, or variants (dialects for instance) of languages or language families, or variants of variants. This Wikipedia module only cares about languages that have entries. (It could also be made to handle codes of variants of those languages, if we wanted to figure that out; they are listed in wikt:Module:etymology languages/data along with variants of language families.) Some languages that have entries use ISO 639 language codes (probably sometimes with a different circumscription from what ISO prescribes), and others use codes that are sequences of two or three sequences of two or three letters joined by hyphens. (The codes for languages that have entries all match a regex
^[a-z][a-z][a-z]?(-[a-z][a-z][a-z]?){0,2}$
, but according to this table, most hyphenated codes have segments of three letters.) There's logic to how the language codes are made, such as that the first segment is usually an existing code, but as far as I know, those making Wiktionary language codes never look at the IANA subtag registry. - Wiktionary puts these idiosyncratic language codes in
lang
attributes in the HTML. When they happen to be valid IETF language tags (as many are), it's because Wiktionary uses an ISO language code and the IANA registry also uses it. There has been talk about translating Wiktionary language codes into IETF tags, but no work on it so far. If Wiktionarians do that, we'll have to come up with some private-use tags, as Wikipedia has done withine-x-proto
, and it could simplify things if Wiktionary and Wikipedia use the same private-use tags. - Anyway, that's a lot of background information. Syncing the
name
field from the Wiktionary language data modules requires 1. grabbing all the pairs of codes and canonical names of languages that have entries from wikt:Module:languages/code to canonical name (this can't be done in Lua on Wikipedia), 2. filtering out the names that are equal to the output ofmw.language.fetchLanguageName(code, 'en')
, 3. writing the remaining codes and names to a new data module on Wikipedia (separate from Module:Language/data, which contains some data that has to be manually edited), 4. making this module use the new data module. Thename
field could then be removed from Module:Language/data. There are several other problems in this module, but this would solve thename
problem. — Eru·tuon 21:49, 17 December 2023 (UTC)- Ah, thank for that. My purpose is to add a level-2-header anchor to a wiktionary interwiki link. With what you've written above, it looks like a two step process. Step one is to query Module:Language/data for the Wiktionary preferred name. When that query returns
nil
, then step two: attempt to fetch the language name from MediaWiki usingmw.language.fetchLanguageName(<tag>, 'en')
. When both fail, use the value in|anchor=
if present and emit an error category; when|anchor=
is missing or empty, emit an error message and an error category so that the underlying data can be fixed. It ain't pretty but it will work I think. - —Trappist the monk (talk) 23:38, 17 December 2023 (UTC)
- Looks good. That's roughly what
{{wikt-lang}}
does already, apart from not having a|anchor=
parameter. — Eru·tuon 22:06, 30 December 2023 (UTC)
- Looks good. That's roughly what
- Ah, thank for that. My purpose is to add a level-2-header anchor to a wiktionary interwiki link. With what you've written above, it looks like a two step process. Step one is to query Module:Language/data for the Wiktionary preferred name. When that query returns
Samaritan
edit{{lang|smp|example}} (the code for Samaritan Hebrew language) adds a page to Category:Articles containing Samaritan-language text but Samaritan language redirects to Samaritan Aramaic language sam
.
-- Error (talk) 20:06, 17 January 2024 (UTC)
- That is not a 'failing' of Module:Language (because that module is not used by
{{lang}}
). It may be a failing of Module:Lang which when queried gives these results:{{lang|fn=category_from_tag|smp|link=yes}}
→ Category:Articles containing Samaritan Hebrew-language text{{lang|fn=name_from_tag|smp|link=yes}}
→ Samaritan Hebrew{{lang|fn=category_from_tag|sam|link=yes}}
→ Category:Articles containing Samaritan Aramaic-language text{{lang|fn=name_from_tag|sam|link=yes}}
→ Samaritan Aramaic
- The ISO 639-3 custodian assigns
smp
to Samaritan. Similarly, the IANA language-subtag-registry file also assignssmp
to Samaritan. Apparently, no one at en.wiki has cared enough about which article is linked whensmp
is used in{{lang}}
to gain a consensus to override the ISO 639-3 name or to repoint the Samaritan-language-redirect so that it points elsewhere. - Issues involving
{{lang}}
,{{transliteration}}
, and other templates that use Module:Lang, should be discussed at Template talk:Lang, not here. Where is it best to discuss repointing the Samaritan-language-redirect? I don't know, except to say that such discussion should not be here. - —Trappist the monk (talk) 20:48, 17 January 2024 (UTC)
- Thanks. Asked at Template talk:lang#Samaritan --Error (talk) 01:23, 18 January 2024 (UTC)
Mis-italicization
editThis should not be applying italics automatically in the case of {{wikt-lang|en|...}}
, only for non-English material (MOS:FOREIGN, MOS:ITALICS). If an English-language term is being used in a words-as-words manner, it can be italicized manually or by a template parameter. — SMcCandlish ☏ ¢ 😼 18:22, 25 June 2024 (UTC)
- I have hacked Module:Language/sandbox to create a common function (permalink) that chooses how the 'text' is rendered. Default rendering is:
- Latn-script text is rendered in italic except when
- the language tag is
en
(English text renders in upright font) |italics=no
- English text may be rendered in italics for MOS:WORDSASWORDS by setting
|italics=yes
(ory
or+
)
- the language tag is
- non-Latn-script text is rendered in upright font except when
|italics=yes
(ory
or+
)
- Latn-script text is rendered in italic except when
- See Template:Wikt-lang/testcases.
- Keep? Discard?
- —Trappist the monk (talk) 19:50, 27 June 2024 (UTC)
Requested move 9 July 2024
edit- The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review after discussing it on the closer's talk page. No further edits should be made to this discussion.
The result of the move request was: moved. Admin: Please double check the subpages associated with this page to ensure nothing else needs to be moved, otherwise it looks like this should be fairly straightforward. (closed by non-admin page mover) ASUKITE 17:42, 17 July 2024 (UTC)
Module:Language → Module:Wikt-lang – This module has a very misleading name. It is solely used to create Wiktionary links with a language anchor, and should not be confused with Module:Lang which is used for most other language related usages. This move will match the template name at Template:Wikt-lang. Gonnym (talk) 12:31, 9 July 2024 (UTC)
- Note: not all of the /data sub-modules actually belong to the module so will need to be checked when disentangling this. Gonnym (talk) 12:34, 9 July 2024 (UTC)
- @Gonnym or whoever understands how these work, from digging through the subpages the only one I found that didn't mention Wiktionary was Module:Language/data/iso 15924 and its doc page, would those potentially need to be moved to Module:Lang/data/iso 15924? ASUKITE 16:27, 17 July 2024 (UTC)
- No. Module:Language/data/iso 15924 is not a submodule of Module:Lang. Do not move it there.
- —Trappist the monk (talk) 16:35, 17 July 2024 (UTC)
- Thanks, that was the only one that was unclear, don't want us to break anything! ASUKITE 16:38, 17 July 2024 (UTC)
- @Gonnym or whoever understands how these work, from digging through the subpages the only one I found that didn't mention Wiktionary was Module:Language/data/iso 15924 and its doc page, would those potentially need to be moved to Module:Lang/data/iso 15924? ASUKITE 16:27, 17 July 2024 (UTC)
- Rename per nom. * Pppery * it has begun... 16:10, 9 July 2024 (UTC)
Uncaught error
editCurrently using the template without a text value produces a Lua error - Lua error in Module:Wikt-lang at line 131: bad argument #1 to 'get_best_script' (string expected, got nil). This should be more gracefully handled like the error in line 248. Gonnym (talk) 12:14, 19 July 2024 (UTC)
- Caught:
{{Wikt-lang|en|}}
→ [text?] Parameter 2 is required{{Wikt-lang|en}}
→ [text?] Parameter 2 is required
- —Trappist the monk (talk) 13:53, 19 July 2024 (UTC)