Template talk:Lang/Archive 13

Latest comment: 4 months ago by SMcCandlish in topic De-italicization glitch

Are there times this template shouldn't be used?

Should all text in a foreign language have this template? Should books, building names etc. also use this? I ask from a position of complete ignorance on the point! Cheers - SchroCat (talk) 16:34, 28 October 2023 (UTC)

{{lang}} should not be used in citation templates ({{cite book}} etc.) except in the |quote= parameter (though I think that if a quotation is important to the article, the quotation should be placed in the article body and properly cited – quotations need citations, citations do not need quotations). Outside of citation templates, I think that {{lang}} should be used for all non-English text so that browsers display the text using appropriate fonts and screen readers have the opportunity to pronounce the non-English text as it should be pronounced.
Trappist the monk (talk) 16:56, 28 October 2023 (UTC)
So! A bit of backstory, but it shouldn't be too technical: This template has to do with the HTML standard, which semantically organizes documents. It takes care of underlying HTML markup: according to the standard, all documents must declare their language (or specifically declare an unknown or no language). Since this is the English Wikipedia, at the very top of the document, it declares that the whole page (the root <html>...</html>) is in English with the lang="en" parameter. Documents without a lang parameter are invalid. You can read more here, at MDN.
Specific parts within the document, actually any HTML tag, can have another language specified. This is very important for applications like screen readers (which can switch to a voice spoken in another language), for example. Screen readers are a good example of the general issue: logically, the document has said it's in English. If there's non-English text there that doesn't declare it's in another language, this makes the document's statement incorrect, and can lead to problems if software is built to take advantage of HTML language specification.
As stated on the template page, the place it shouldn't be used is in certain citation templates, because the order in which templates are parsed becomes an issue, and it clogs the citation metadata. There are parameters within those templates that allow you to specify when that metadata is in another language, which will appropriately apply the lang parameter within the HTML document.
So that is to say: yes, absolutely. If a word is not an English word, it should be tagged. (Though, of course, with place names and such, the boundary is distinctly less clear, so I am not bemoaning that. But keep the principle in mind!) Remsense 17:00, 28 October 2023 (UTC)
  • Excellent - thanks very much to you both. Cheers - SchroCat (talk) 18:59, 28 October 2023 (UTC)
    In practice, lang templates have generally not been used with proper names very much in our articles, though probably they should be, e.g. {{lang|ga|Caoimhín Ó Raghallaigh|italic=unset}} – that last parameter to keep from italicizing it, since we wouldn't italicize a personal or geographical name, except when contrasting it with an anglicization, as in "Munich (German: München)". It would actually be helpful to screen readers and such to use the template this way (I shudder to think what a screen reader does when trying to interpret "Caoimhín Ó Raghallaigh" as something to pronounce as if it's English), but it would be a really large job to actually implement that, and some resistance might be met, since it complicates the wikicode.  — SMcCandlish ¢ 😼  01:11, 29 October 2023 (UTC)
    SMcCandlish, with regard to 'probably should be used more', I've just gone and created {{langr}} (for 'roman') that's a quick alias for {{lang|italic=unset}}. I know it's a few characters, but the lack of an extra parameter really seems to incentivize the quicker use of templates—does for me anyhow. — Remsense 01:29, 29 October 2023 (UTC)
    Thank you for that gift! I don't think I will fix the thousand of "italic=no", but one letter instead of an extra parameter is a relief! Perhaps a bot could change the older ones, to make users aware it exists. --Gerda Arendt (talk) 07:29, 29 October 2023 (UTC)
    Gerda Arendt, i certainly think it's worth the extra category entry/name to remember/what have you, it's a relief that others seem to agree :)! i just tend to swap it out in articles i'm editing to make things easier to read within the article (alongside adding to other places of course) — Remsense 10:48, 29 October 2023 (UTC)
    Hopefully that will actually work out in getting people to use it.  — SMcCandlish ¢ 😼  02:09, 29 October 2023 (UTC)
    I will be using it, in any case. My main thing is Chinese, and the screenreader I tested doesn't do very well with nondiacritical pinyin, even though it could, so I was wondering if there was even a point to tagging it, but I definitely should regardless, per my own essay above. Remsense 02:15, 29 October 2023 (UTC)
    I tried an implementation of this in a live article [1] at Caoimhín Ó Raghallaigh (along with some other cleanup there). I haven't pored over the code of {{langr}}, but I assume it passes-through other parameters like for RtL text, etc. As for Chinese rendering, I'm really not sure what the best approach is, when it comes to various different romanization systems. There may be advice about this somewhere, at Wikipedia:Manual of Style/China- and Chinese-related articles or talk page thereof, or at Template:Lang-zh. May need to account for parameters that specify transliteration.  — SMcCandlish ¢ 😼  02:36, 29 October 2023 (UTC)
    SMcCandlish, all it does is call the same module {{lang}} does, but sets the italics parameter for you. So, if it has issues, I would be really worried! — Remsense 02:38, 29 October 2023 (UTC)
    Ah, I think it will need to handle additional parameters of {{lang}}, like |rtl= and |size= and definitely |nocat= and |cat=, in a pass-through manner. I don't know if any of the special parameters for {{lang-zh}} are also supported (or needed) by {{lang|zh}}.  — SMcCandlish ¢ 😼  02:43, 29 October 2023 (UTC)
    I will do some testing of those ASAP, thanks for letting me know. Remsense 02:44, 29 October 2023 (UTC)
    Update: I don't think you need to do anything manually to the template code. I'm really old-school with templates, and don't spend much time messing about with Lua modules; it wasn't clear to me that by invoking the same module it just auto-handles the parameters. I just tested [[Caoimhín Ó Raghallaigh|{{langr|ga|Ó Raghallaigh|nocat=y}}]] in a mainspace sandbox (the categorization stuff only happens in mainspace), and it worked fine. If the module wasn't "magically" getting the |nocat=y despite it not being explicitly named in the template code, then the link would have been mangled, by having a category link jammed inside of it.  — SMcCandlish ¢ 😼  12:09, 29 October 2023 (UTC)

Whole-page wrapper idea

"but it would be a really large job to actually implement that, and some resistance might be met, since it complicates the wikicode"

That's why we need some template that will be wrapped around the whole article with lang parameters for every non-English word used in the article. E.g. in Alvar Aalto:
{{Lang-wrapper|fi=Alvar,Aalto,Aino,Jyväskylä|sv=Ahlström-Gullichsen|de=Gesamtkunstwerk|article=
*START OF THE ARTICLE; i.e. {{Short description}}, {{Infobox}} etc.*
'''Hugo Alvar Henrik Aalto''' ({{IPA-fi|ˈhuːɡo ˈɑlʋɑr ˈhenrik ˈɑːlto|pron}}; 3 February 1898 – 11 May 1976) was a Finnish [[architect]] and designer.&lt;ref name=Chilvers&gt;{{harvnb|Chilvers|2004|p=1}}&lt;/ref&gt; His work includes architecture, furniture, [[textiles]] and [[glassware]], as well as sculptures and paintings. He never regarded himself as an artist, seeing painting and sculpture as "branches of the tree whose trunk is architecture."&lt;ref name=Enckell&gt;{{harvnb|Enckell|1998|p=32}}&lt;/ref&gt; Aalto's early career ran in parallel with the rapid economic growth and industrialization of Finland during the first half of the 20th century. Many of his clients were industrialists, among them the [[Ahlström-Gullichsen family]], who became his patrons.&lt;ref name="Ahlström"&gt;{{harvnb|Anon|2013}}&lt;/ref&gt; The span of his career, from the 1920s to the 1970s, is reflected in the styles of his work, ranging from [[Nordic Classicism]] of the early work, to a rational [[International Style (architecture)|International Style]] Modernism during the 1930s to a more organic modernist style from the 1940s onwards.

His architectural work, throughout his entire career, is characterized by a concern for design as [[Gesamtkunstwerk]]—a ''total work of art'' in which he, together with his first wife [[Aino Aalto]], would design not only the building but the interior surfaces, furniture, lamps, and glassware as well. His furniture designs are considered [[Scandinavian design|Scandinavian Modern]], an aesthetic reflected in their elegant simplification and concern for materials, especially wood, but also in Aalto's technical innovations, which led him to receiving patents for various manufacturing processes, such as those used to produce bent wood.&lt;ref name=Boy&gt;{{harvnb|Boyce|1985|p=1}}&lt;/ref&gt; As a designer he is celebrated as a forerunner of [[Mid-century modern|midcentury modernism]] in design; his invention of bent plywood furniture&lt;ref&gt;{{Cite book|last=Norwich|first=John Julius|title=Oxford Illustrated Encyclopedia of the Arts|publisher=Oxford University Press|year=1990|isbn=978-0-19-869137-2|location=US|pages=1}}&lt;/ref&gt; had a profound impact on the aesthetics of [[Charles and Ray Eames]] and [[George Nelson (designer)|George Nelson]].&lt;ref&gt;{{Cite web|title=Alvar Aalto|url=https://www.dwr.com/designer-alvar-aalto?lang=en_US|website=www.dwr.com}}&lt;/ref&gt; The [[Alvar Aalto Museum]], designed by Aalto himself, is located in what is regarded as his home city, [[Jyväskylä]].&lt;ref&gt;{{harvnb|Alvar Aalto Museum|2011}}&lt;/ref&gt;

(...)

*END OF THE ARTICLE; i.e. navigation boxes, [[Category:Finnish people]] etc.*

}} (-> closing curly brackets of "Lang-wrapper")
So, |fi=Alvar,Aalto,Aino,Jyväskylä would mark all occurrences of the words Alvar, Aalto, Aino and Jyväskylä as Finnish-language text in the whole article, |sv=Ahlström-Gullichsen would mark Ahlström-Gullichsen as Swedish-language text and |de=Gesamtkunstwerk would mark Gesamtkunstwerk as German-language text. Now I don't know if this is technically possible to implement, so this is just an idea for now. 2001:14BA:9CE5:8400:9D39:7444:AD64:FBB1 (talk) 03:02, 29 October 2023 (UTC)
That seems particularly resource intensive and non-canonical for how Wikipedia operates. Remsense 03:06, 29 October 2023 (UTC)
I'm not sure that it's technically even doable. Even if it were, there are instances where the underlying HTML lang="xx" markup cannot be imposed (with <span>...</span> or otherwise), e.g. on most parameter values in citation templates other than |quote=. Or on terms that are bare wikilinks or are on the left side of piped links. Or terms inside URLs. Or .... And certainly nothing like this would be done as a page-wide wrapper for the entire article content. Ever. For any reason.  — SMcCandlish ¢ 😼  06:40, 29 October 2023 (UTC)

HTML code streamling question

  Resolved

Is there a good reason this is emitting double spans, or a span plus italics?

Given code of the form {{lang|ga|srón}} and {{lang|ga|Pádraig|italic=unset}}, the output is, respectively:

<span title="Irish-language text"><i lang="ga">srón</i></span>
<span title="Irish-language text"><span lang="ga">Pádraig</span></span>

That looks like code bloat, and would be better rendered as:

<span title="Irish-language text" lang="ga"><i>srón</i></span>
<span title="Irish-language text" lang="ga">Pádraig</span>

using a single span for language-related metadata, and just adding a bare <i>...</i> if it is needed.

Likewise for other parameter stuff that needs to translate into language-related metadata. E.g. {lang|he|עבר‎}} gives:

<span title="Hebrew-language text"><span lang="he" dir="rtl">עבר‎</span></span>

which would be leaner and cleaner as:

<span title="Hebrew-language text" lang="he" dir="rtl">עבר‎</span>

 — SMcCandlish ¢ 😼  11:50, 29 October 2023 (UTC)

Template talk:Lang/Archive 11 § Lang and title param
Trappist the monk (talk) 12:03, 29 October 2023 (UTC)
Ah, yes, that would explain it. Thank you.  — SMcCandlish ¢ 😼  12:12, 29 October 2023 (UTC)

Inline translations

Is there a mechanism for including English language translations of foreign terms?

Currently I'm using efn for this:

the {{lang|fr|Nid de la Poule}}{{efn|Hen's Nest}} crater
...
{{notelist}}

Which produces this (normally the note is displayed in a tooltip):

the Nid de la Poule[a] crater

  1. ^ Hen's Nest

Something like this would be cleaner though:

the {{lang|fr|Nid de la Poule|translation=Hen's Nest}} crater

See, e.g., Puy_de_Dôme#Tourism

Alex Hajnal (talk) 22:33, 5 November 2023 (UTC)

Not in {{lang}} but you might rewrite that sentence somehow and use:
The summit can be reached by two [[Trail|pedestrian paths]]: a southern one ({{lang-fr|Le sentier des muletiers|translation=The Mule Trail}}, formerly a [[Roman road]]) and a northern one ({{lang-fr|Le sentier des chèvres|translation=The Goat Trail|label=none}}) which runs past the {{lang-fr|Nid de la Poule|translation=Hen's Nest|label=none}} crater.
The summit can be reached by two pedestrian paths: a southern one (French: Le sentier des muletiers, lit.'The Mule Trail', formerly a Roman road) and a northern one (Le sentier des chèvres, 'The Goat Trail') which runs past the Nid de la Poule, 'Hen's Nest' crater.
or just include the translations parenthetically in the sentence:
...the {{lang|fr|Nid de la Poule}} ('Hen's Nest') crater → ...the Nid de la Poule ('Hen's Nest') crater
Trappist the monk (talk) 23:06, 5 November 2023 (UTC)
Do you think there's anything inherently wrong with using efn for this? Edit: I presume using lang-fr would be highly enouraged.Alex Hajnal (talk) 23:16, 5 November 2023 (UTC)
You can pretty-much do what you want. From a reader's point of view, using {{efn}} for such short translations seems to require more work than perhaps it's worth because the reader has to, at minimum, float their mouse-pointer over the {{efn}} superscript in order to see what is hidden there. I neither encourage nor discourage the use of {{lang-fr}}; I merely offer it as an option that you can consider.
Trappist the monk (talk) 23:35, 5 November 2023 (UTC)
Definitely the most common way to do this is with {{lang}} and plain-English after it:
...the {{lang|fr|Nid de la Poule|italic=unset}} ('Hen's Nest') crater → ...the Nid de la Poule ('Hen's Nest') crater
or
...the {{lang|fr|Nid de la Poule|italic=unset}} crater (the name of which means 'Hen's Nest') → ...the Nid de la Poule crater (the name of which means 'Hen's Nest')
(with |italic=unset in this specific kind of case because we don't italicize proper names in most cases). It requires no footnote futzing-around for the reader, and is more flexible and less template-geeky for the editor, compared to something like:
...the {{lang-fr|Nid de la Poule|translation=Hen's Nest|label=none|italic=unset}}, crater → ...the Nid de la Poule, 'Hen's Nest', crater
Japanese is kinda-conventionally a special case, often done with a complex template called {{Nihongo}}, which participants at WP:JAPAN are big fans of, but some of us are not, at least not for cases of this sort (versus, perhaps, the opening line of an article on Japanese subject).  — SMcCandlish ¢ 😼  15:01, 6 November 2023 (UTC)
OK, thanks for the feedback.
My rationale was to not break up the flow of the sentences too much with a lot of clauses and parentheticals. Of course, requiring/encouraging the mousing-over of the superscript breaks the flow as well. Bit of a double-edged sword.
Browsing though the docs it looks like Template:tooltip is also an option:

{{lang|fr|{{tooltip|Nid de la Poule|Hen's Nest}}}}

Giving:

Nid de la Poule

Thanks again.

Alex Hajnal (talk) 18:54, 7 November 2023 (UTC)

Needs Proto-Germanic

If it's already there, then it just needs to be set to understand Wiktionary's gem-pro code as referring to Proto-Germanic and to add the necessary italics and HTML tags. — LlywelynII 00:38, 11 December 2023 (UTC)

{{lang|fn=name_from_tag|gem-x-proto}} → Proto-Germanic – listed at Template:Lang § Private-use language tags.
gem-pro is not a valid IETF language tag. To be valid, the extlang subtag must be defined in the IANA language-subtag-registry file. That file does not list pro as an extlang. Because all currently defined extlangs refer to languages that have primary language tags, Module:Lang does not support extlangs.
Trappist the monk (talk) 01:43, 11 December 2023 (UTC)
Can't this be done (using some code or other) with the private-use codes described in #New codes, above? I wouldn't mind having one for Proto-Celtic using cel- as the base.  — SMcCandlish ¢ 😼  22:51, 11 December 2023 (UTC)
For Proto-Germanic we have the private-use tag: gem-x-proto. Similarly, for Proto-Celtic, we have: cel-x-proto:
{{lang|fn=name_from_tag|cel-x-proto}} → Proto-Celtic
Both are listed at Template:Lang § Private-use language tags.
Trappist the monk (talk) 22:59, 11 December 2023 (UTC)
Ah so!  — SMcCandlish ¢ 😼  03:43, 13 December 2023 (UTC)

Common Brittonic

Given the above, I can definitely see a use at various articles (like Yan tan tethera) for cel-x-brittonic for Common Brittonic AKA Common Brythonic, Old British, Proto-Brythonic, etc. There's no ISO base name for this (or the Insular Celtic sub-family it usually gets classified into, and for which I can't think of a private-use-code need), but the root language family is Celtic languages with a code of cel, which we're also already using in cel-x-proto for Proto-Celtic.  — SMcCandlish ¢ 😼  19:39, 17 December 2023 (UTC)

The subtag following the x singleton must be 1–8 characters; brittonic is 9 characters. See IETF language tag § Syntax of language tags.
Trappist the monk (talk) 20:01, 17 December 2023 (UTC)
Derp. In that case, we could keep it quite short with cel-x-brit. I don't think that would be ambiguous with anything. cel-x-combrit or cel-x-britton could also work if we wanted to be longer.  — SMcCandlish ¢ 😼  22:19, 17 December 2023 (UTC)
I chose cel-x-combrit because we have a Brittonic languages article which would use cel-x-brit if it ever becomes necessary.
{{lang|fn=name_from_tag|link=yes|cel-x-combrit}}Common Brittonic
Trappist the monk (talk) 23:46, 17 December 2023 (UTC)
Good call, and thanks for adding it.  — SMcCandlish ¢ 😼  00:40, 18 December 2023 (UTC)

`yue-jyutping`, but not `yue-Latn-jyutping`

Forgive me if I missed this somewhere, but is it canonical that the code for Jyutping romanization of Cantonese should be yue-jyutping, but not yue-Latn-jyutping?
I'm comparing with Hanyu Pinyin for Standard Chinese, which is often tagged either with zh-Latn or zh-Latn-pinyin. Remsense 00:29, 18 December 2023 (UTC)

Tested, and |yue-Latn-jyutping throws "Error: {{Lang}}: unrecognized variant: jyutping for code-script pair: yue-latn (help)". That's not very intuitive, since -Latn seems to apply to anything that has been transliterated from another character set into Latin-based chars.  — SMcCandlish ¢ 😼  00:49, 18 December 2023 (UTC)
Also, the |j= parameter of {{zh}} emits a yue-Latn-jyutping tag, so it seems likely that one of the two templates is misbehaving. Remsense 00:54, 18 December 2023 (UTC)
{{zh}} is not rendered by Module:Lang. We have no control over that template.
Trappist the monk (talk) 01:04, 18 December 2023 (UTC)
Who knows? By definition, Jyutping is a romanization system so it would seem that Latn is superfluous. The standard is the standard. Complaints about the standard should be directed to the custodians of the standard.
Trappist the monk (talk) 01:04, 18 December 2023 (UTC)
Sorry if my question was unclear—I was just asking if it might be an error here or at IANA. Thank you for the reply, and thanks for all the work you do in this area of the site. :) Remsense 01:06, 18 December 2023 (UTC)
According to the IANA language-subtag-registry file:
%%
Type: variant
Subtag: jyutping
Description: Jyutping Cantonese Romanization
Added: 2010-10-23
Prefix: yue
Comments: Jyutping romanization of Cantonese
%%
so Module:Lang is correct when it emits an error message complaining about yue-Latn-jyutping:
{{lang|yue-Latn-jyutping|yue-Latn-jyutping}} → [yue-Latn-jyutping] Error: {{Lang}}: unrecognized variant: jyutping for code-script pair: yue-latn (help)
I cannot explain why zh-Latn-pinyin is preferred over zh-pinyin. If you think that IANA are wrong, you must take it up with them.
Trappist the monk (talk) 01:04, 18 December 2023 (UTC)

De-italicization glitch

Shelta uses English orthography, sometimes with some Irish diacritics, and sometimes the additional character χ. The presence of that character in any {{lang|sth|...}} string causes the entire string to be de-italicized automagically, and this is undesirable. See, e.g., Shelta#Grammar, and note how the first and last items in the table have been forced into roman mode.  — SMcCandlish ¢ 😼  00:39, 18 December 2023 (UTC)

It does that because χ is U+03C7 Greek small letter chi. Any non-Latn character in the text causes Module:Lang to render the text in upright font. Is χ really the proper character or did someone simply search the characters in the char-insert tables and use whatever they found that looked more-or-less correct?
You can override the upright font:
{{lang|sth|gloχi|italic=yes}}gloχi
Trappist the monk (talk) 01:28, 18 December 2023 (UTC)
There is ꭕ (U+AB55 Latin small letter chi with low left serif) in Latin Extended-E:
{{lang|sth|gloꭕi}}gloꭕi
Trappist the monk (talk) 02:05, 18 December 2023 (UTC)
Given that all of this is based on printed books, it is likely that someone editing here just used χ as the first visual match they found for what they saw in the book, which could equally well be rendered with , so might as well switch to that, since it's within the extended Latin character set and is not jumping ship to Greek.  — SMcCandlish ¢ 😼  02:38, 18 December 2023 (UTC)
PS: I think it happened because the IPA symbol for the sound is actually the Greek glyph χ; trying to replace that in the IPA chart with broke the IPA template. The article has to use both in differen places, the IPA symbol for the sound in the IPA chart, and the extended Latin variant in running text for the word spellings.  — SMcCandlish ¢ 😼  02:44, 18 December 2023 (UTC)