Jump to content

Module talk:Lang-zh

From Calamity Wiki
Revision as of 19:05, 29 March 2026 by imported>Lowercase sigmabot III (Archiving 1 discussion(s) to Module talk:Lang-zh/Archive 6) (bot)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Permanently protected Template:WPBS Template:Central Template:Archive box

L switch throwing Linter errors when value ends with a closing italics tag

Just noticed this on the Mangtong page while clearing old "missing end tag" errors:

Code... Renders as...
A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=reformed ''mangtong''}}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.


It seems like passing a value ending with an italicized value via the l= parameter throws the Linter error. Adding a &nbsp or equivalent parameter after the closing italics tag won't resolve the error...

A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=reformed ''mangtong'' }}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.
A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=reformed ''mangtong''{{nbsp}}}}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.
A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=reformed ''mangtong'' }}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.


The only solution appears to be if a non-apostrophe/non-quotation after the close-italics tag but before the }}:

A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=′reformed ''mangtong''′}}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.

...which seems a bit of a hack.


Interestingly, attempting to italicize the entire value results in both italics tags being ignored (same as when leaving italics tags out altogether)...

A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=''reformed mangtong''}}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.
A modernized version of the ''mangtong'', called ''gǎigé mángtǒng'' ( {{zh|c=改革芒筒|l=reformed mangtong}}), was developed in the 20th century. A modernized version of the mangtong, called gǎigé mángtǒng ( Template:Zh), was developed in the 20th century.

Any chance this can be fixed?

SirOlgen (talk) 16:28, 21 August 2025 (UTC)

So to put it in non-Lint terms, it doesn't appear as though this template's "literal" parameter is properly handling italics tags which occur either first or last in the passed string. SirOlgen (talk) 18:09, 21 August 2025 (UTC)
Yes, see this previous discussion: Module_talk:Lang-zh/Archive_5#Trailing_bold_in_l=_not_being_removed. A workaround is to use HTML italic tags, e.g. {{zh|l=reformed <i>mangtong</i>}} for Template:Zh. The stripping of bold and italic markup is commented in the code but not mentioned in the template documentation. At the time of the previous discussion, I wasn't convinced that stripping quotation marks was necessary, but I also didn't know of any use cases where it would cause a problem and so I didn't push the point further. However, this looks like a valid use case, and I think we should revisit the question of why quotes should be stripped. In contrast, this doesn't happen for {{lit}}, which otherwise has extremely similar functionality to the |l= parameter. Freelance Intellectual (talk) 21:57, 22 August 2025 (UTC)
Thanks a million for the background info and workaround (I'm embarrassed for not having thought to try that, LOL). This does seem like a pretty obscure use case, but it also seems a near certainty there will be more examples out there among the 1.9M outstanding "missing end tag" errors.
Thanks again!
SirOlgen (talk) 02:11, 24 August 2025 (UTC)
I have boldly removed the stripping of ' marks from the |l= parameter in the module sandbox. I added test cases from the previous discussion to Template:Lang-zh/testcases (see the "miscanthus" example and the following three tests). Does anyone see any problems on the testcases page? The potential downside is that bold formatting is applied, as in the "Bamboo Forest station" example. Given that this bold/italic stripping is not mentioned in the documentation, removing this stripping may be fine. Pinging Remsense from the previous conversation. – Jonesey95 (talk) 13:50, 11 September 2025 (UTC)
Thanks for this! I added testcases for simple literal string italicization of (A) the full string, (B) the first word, and (C) the last word. Looks solid. I didn't notice anything out of whack in the other testcases (other than what's flagged in red). – SirOlgen (talk) 20:42, 11 September 2025 (UTC)
Good test cases. I have somewhat trepidatiously migrated this change to the live module. This will cause bold in places where it has been hidden until now. It is not clear to me why this template was stripping bold markup, or whether that was a side-effect of trying to remove single ' characters used as quotation marks. I expect that if this change causes any harm, we'll get a note on this page. – Jonesey95 (talk) 21:47, 11 September 2025 (UTC)

Edit request 20 December 2025

Template:Edit template-protected

Minor change, but a comment refers to Tongyong Pinyin as "Tongyu Pinyin". This should be changed, for clarity for readers of the module.

Diff:

−
Tongyu Pinyin
+
Tongyong Pinyin

Ookap (talk) 20:01, 20 December 2025 (UTC)

Template:Complete2. P.I. Ellsworth , ed. – welcome! – 10:27, 22 December 2025 (UTC)

Hi all! Could we please add Yale romanization of Mandarin to the template? Given that this is the English-language wikipedia, and the set of spelling/pronunciation rules used by Yale romanization of Mandarin is the closest to English's own spelling/pronunciation rules, it would be helpful if Yale romanization of Mandarin could be added to the template. In many cases, this would be helpful for native English speakers to pronounce Chinese words even if they haven't learnt any system of romaization of Mandarin before, as the system of Yale romanization of Mandarin was designed to be intuitive for English speakers. Many thanks! – 星球统领 (talk) 23:36, 11 February 2026 (UTC)

@星球统领: The current consensus is that pinyin is the default romanisation of Mandarin, and other systems are only to be used in special cases; see MOS:PINYIN. Freelance Intellectual (talk) 15:35, 12 February 2026 (UTC)
It isn't this template's objective to require any particular transliteration - that is left to the MOS:PINYIN to decide. The template was designed to support common transliterations that may be required in an article, but it is not exhaustive. For less commonly used transliterations, alternative markup methods exist, such as Template:Transliteration and Template:Langx. Rincewind42 (talk) 13:14, 13 February 2026 (UTC)

This is a request to add Pe̍h-ūe-jī (Teochew Church Romanisation) to the template. I have recently adding a lot of romanisations for people on singapore related articles and many have teochew names so it is quite frustrating to keep having to type " ; Pe̍h-ūe-jī: " for every single case of teochew usage. Warpswitch (talk) 21:51, 28 March 2026 (UTC)