Template talk:Lang
Add topic| This is the talk page for discussing improvements to the Lang template. |
|
| Archives: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16Auto-archiving period: 4 months |
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
| ||||||||
| Template:Lang is indefinitely protected from editing as it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
| This template was considered for deletion on 2006 February 20. The result of the discussion was keep. |
| To help centralize discussions and keep related topics together, the talk pages for all help pages, categories, MediaWiki messages and templates related to Template:Lang redirect here. |
Lang-rus merge
[edit]At Wikipedia:Templates for discussion/Log/2025 April 17#Template:Lang-rus it was proposed to replace {{Lang-rus}} with {{lang}} and {{langx}} templates. The discussion ended with the result of merging the features of {{Lang-rus}}, which mostly means enabling {{lang}} to have access to the additional features {{langx}} has leaving the only difference between the two templates the language name appearance vs tooltip. The only parameter left that both don't use is an IPA parameter, but since both don't use it, this could probably either be handled as we do now, or added as a new feature. Gonnym (talk) 08:30, 15 May 2025 (UTC)
- Agreed. Gommeh ➡️ Talk to me 19:52, 15 May 2025 (UTC)
- @Trappist the monk: is this something you could look into? Been over a year since this TFD was closed as merge. Would be great to get some forward progress if you have time! Zackmann (Talk to me/What I been doing) 05:50, 20 May 2026 (UTC)
{{lang-rus}}is just a wrapper template around{{language with name}}(which wraps{{lang}}),{{transliteration}}, and{{IPA}}.{{lang-rus}}could be simplified somewhat by replacing:{{Language with name|ru|Russian|links={{{links|no}}}|{{{1|}}}|italic={{{italic|unset}}}}}{{#if:{{{r|{{{2|}}}}}}|, <small>[[Romanization of Russian|romanized]]:</small> {{Transliteration|ru|{{{r|{{{2}}}}}}}}}}
- with:
{{langx|code=ru|links={{{links|no}}}|italic={{{italic|}}}|text={{{1}}}|translit={{{r|{{{2|}}}}}}}}
- —Trappist the monk (talk) 16:51, 26 May 2026 (UTC)
- The TfD resulted in deletion of that template, not turning it into a wrapper. Also, Russian isn't the only language that is doing hacks to get langx capabilties when using lang. Gonnym (talk) 18:02, 26 May 2026 (UTC)
- From this November 2009 version,
{{lang-rus}}has always been a wrapper template. Simplifying as I described above is notturning it into a wrapper
. - —Trappist the monk (talk) 11:29, 27 May 2026 (UTC)
- The wrapper discussion while interesting is irrelevant to the TfD result and the above request. I've fixed enough usages of lang/langx templates to know that editors want langx options available for lang usages. There really is no reason to have this distinction other than inertia. Gonnym (talk) 19:10, 27 May 2026 (UTC)
- From this November 2009 version,
- The TfD resulted in deletion of that template, not turning it into a wrapper. Also, Russian isn't the only language that is doing hacks to get langx capabilties when using lang. Gonnym (talk) 18:02, 26 May 2026 (UTC)
- @Trappist the monk: is this something you could look into? Been over a year since this TFD was closed as merge. Would be great to get some forward progress if you have time! Zackmann (Talk to me/What I been doing) 05:50, 20 May 2026 (UTC)
Feature request: Suppress language label
[edit]It would be nice if there were a way to format foreign text, transliteration and translation under a single template with the language going only into the metadata. Adding |translit= and |translation= to {{lang}} is a viable aternative to adding a |suppress-language=yes parameter to {{langx}}. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 16:04, 15 March 2026 (UTC)
Changing name of a language
[edit]When entering the code tfn, this template produces a link to the Tanaina language -- but that's not the common spelling. I'm a bit clueless with templates, so I'm not sure where that's coming from, but the common term and modern spelling is Dena'ina, as reflected in the article Dena'ina language. Is it even possible to change that on this page? GreenLipstickLesbian💌🧸 16:45, 2 April 2026 (UTC)
{{lang}}gets its language tags and names from the IANA language-subtag-registry file. IANA gets its tags and names (in part) from the ISO 639-3 custodian which definestfnas 'Tanaina'.- I have added an override to cause Module:Lang to use Denaʼina.
{{lang|tfn|fn=name_from_tag|link=yes}}→ Denaʼina
- Category:Articles containing Tanaina-language text must be moved to Category:Articles containing Denaʼina-language text; I leave that to you.
- —Trappist the monk (talk) 17:12, 2 April 2026 (UTC)
- Ah, thank you for both the explanation and adding the override! And yeah, I'll happily take over the category work. GreenLipstickLesbian💌🧸 21:05, 2 April 2026 (UTC)
Template-protected edit request on 23 April 2026
[edit]This edit request to Module:Lang has been answered. Set the |answered= parameter to no to reactivate your request. |
The values ca and us for the {{{engvar}}} parameter are redundant, as they do not change the spelling of “romanized.” I suggest we remove them. 2600 etc (talk) 01:17, 23 April 2026 (UTC)
- Not done. As a convenience to editors, the value assigned to
|envar=should match the article's{{use <country> English}}template. - —Trappist the monk (talk) 12:38, 26 April 2026 (UTC)
Font
[edit]Why does this output the heading "Ancient Greek" in a weird serif font? ~2026-26990-82 (talk) 02:28, 10 May 2026 (UTC)
- Can't read your mind. When you encounter an issue, always say where you are seeing it; always.
- For me, this:
{{langx|grc|Κλεοπάτρα}}→ Ancient Greek: Κλεοπάτρα
- renders correctly.
- —Trappist the monk (talk) 02:40, 10 May 2026 (UTC)
- Here's an example, but with Chinese instead: French_cruiser_Villars#Battle_of_Fuzhou. Any idea why the template randomly seems to change fonts for some languages? Parsecboy (talk) 18:44, 11 June 2026 (UTC)
- Copy the specific code here please. Gonnym (talk) 19:01, 11 June 2026 (UTC)
- You mean these ship names?
{{lang|zh|Zhenwei}}, {{lang|zh|Feiyun}}, and {{lang|zh|Ji'an}}
- Your browser chooses a font according to the language tag. You are telling the browser that these ship names are written in the Chinese language (
zh) so your browser applies a font that it believes to be correct for that language. But, the ship names are not written using a Chinese script. Rather, they are written using the Latn script. Compare:- Zhenwei, Feiyun, and Ji'an ←
{{lang|zh|Zhenwei}}, {{lang|zh|Feiyun}}, and {{lang|zh|Ji'an}}– Latn script using a Chinese font - Zhenwei, Feiyun, and Ji'an ←
{{lang|zh-latn|Zhenwei}} {{lang|zh-latn|Feiyun}} and {{lang|zh-latn|Ji'an}}– Latn script using a Latn font - Zhenwei, Feiyun, and Ji'an ←
''Zhenwei'', ''Feiyun'', and ''Ji'an''– Latn script using the default font
- Zhenwei, Feiyun, and Ji'an ←
- The second form should force your browser to use the same font as the article uses (third form).
- —Trappist the monk (talk) 19:18, 11 June 2026 (UTC)
- Thanks, Trappist - I figured there was a parameter I could tweak to fix it, but couldn't figure it out from the documentation. Parsecboy (talk) 19:39, 11 June 2026 (UTC)
- @Trappist the monk Just as an FYI, appending
-Latndoes not always force the browser to use the same font as the rest of the article, but rather it forces whichever font the browser associates with that particular language in the Latin script. This is relevant for Chinese, where monospaced fonts are sometimes preferred (or at least they used to be). Theknightwho (talk) 13:24, 14 July 2026 (UTC)
- Here's an example, but with Chinese instead: French_cruiser_Villars#Battle_of_Fuzhou. Any idea why the template randomly seems to change fonts for some languages? Parsecboy (talk) 18:44, 11 June 2026 (UTC)
Feature request: Module:Lang support for {{Lang(x)}} to recognize CLCR codes (qXX) or long codes (art-x-X*)
[edit]This may exist as a separate template, but I don't know of a way to tag conlanguage text in this manner (and if it isn't and this feature isn't possible/practical, I'd be happy to create and upkeep that new template if I could get some advice!). —It's Okkirae.temp ('Sup?)! 01:41, 22 May 2026 (UTC)
- Long-form CLCR language tag support is available though, at the moment, only
art-x-uropiis defined:{{lang|fn=name_from_tag|art-x-uropi|link=yes}}→ Uropi{{lang|fn=category_from_tag|art-x-uropi|link=yes}}→ Category:Articles containing Uropi-language text
- —Trappist the monk (talk) 17:00, 26 May 2026 (UTC)
- Is it possible/proper to define the rest of them? Okkirae∤(䆿±䋚) 18:31, 26 May 2026 (UTC)
- Possible? Yes. Proper? Probably not. If you have a need for a CLCR language tag, it can be added.
- —Trappist the monk (talk) 11:33, 27 May 2026 (UTC)
- Is there a way for myself to create a fork of the Lang template for this purpose? I'm new to template coding but determined. Okkirae∤(䆿±䋚) 14:16, 27 May 2026 (UTC)
- At en.wiki, template forking is discouraged. If you need CLCR language tags, they can be added.
- —Trappist the monk (talk) 14:29, 27 May 2026 (UTC)
- Alright, thanks anyway. Okkirae∤(䆿±䋚) 01:51, 30 May 2026 (UTC)
- Is there a way for myself to create a fork of the Lang template for this purpose? I'm new to template coding but determined. Okkirae∤(䆿±䋚) 14:16, 27 May 2026 (UTC)
- Is it possible/proper to define the rest of them? Okkirae∤(䆿±䋚) 18:31, 26 May 2026 (UTC)
Edit request
[edit]This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Change Patani Malay > Kelantan–Pattani Malay coz the former redirects to Patani Malays. Ahri Boy (talk) 09:47, 30 May 2026 (UTC)
- Module:Lang does not recognize 'Patani Malay':
{{lang|Patani Malay|fn=tag_from_name}}→ Error: language: Patani Malay not found
- Perhaps you meant to write 'Pattani Malay'. Module:Lang recognizes that name but it does not create links to Patani Malays:
{{lang|Pattani Malay|fn=tag_from_name}}→ mfa →{{lang|mfa|fn=name_from_tag|link=yes}}→ Pattani Malay ←[[Pattani Malay language|Pattani Malay]](a redirect to Kelantan–Pattani Malay)
- At this edit, Editor The Bangsawan changed the redirect target from Kelantan–Pattani Malay to Patani Malays. For most of its existence, the Patani Malay redirect has pointed to the language article, not the ethic group article. If there is an issue with the Patani Malay redirect, you should take up that issue with Editor The Bangsawan.
- —Trappist the monk (talk) 13:10, 30 May 2026 (UTC)
- Thank you for adding the header on the article Ahri Boy. د بڠساون (talk) 04:46, 5 June 2026 (UTC)
Errors for writing Greek in roman alphabet
[edit]It appears from the writeup of template:lang that something {{lang|grc|JJJQJ}} (picking latin letters as far as way from greek letters as possible) should generate *some* level of error. I've got quite a few similar examples in mainspace and I'm not seeing any errors or any invisible categories for it.Naraht (talk) 17:21, 10 June 2026 (UTC)
- For the example that you give, there should be no errors:
{{lang|grc|JJJQJ}}→<span title="Ancient Greek (to 1453)-language text"><i lang="grc">JJJQJ</i></span>→ JJJQJ
- What exactly makes you think that there should be errors? Where exactly are you expecting to see these errors?
- —Trappist the monk (talk) 17:30, 10 June 2026 (UTC)
- I think they meant that if you use Greek words then they should be written in Greek alphabet and not in Latin alphabet. If this error check can happen, it should probably be for other non-Latin langauges (he, ar, etc.) Gonnym (talk) 18:28, 10 June 2026 (UTC)
- That is what I meant. From the writeup of the template, I expected something to be generated in that case. I know that there are a *few* languages equally appropriate to put multiple character sets (Serbo-Croatian is one if you consider it one language, and I think a few of the post-soviet stans both use their 19th century script and either Cyrillic or Roman) but in my mind the example above should generate *something* that can be set to be seen by an experienced editor. I still haven't made up my mind if something like {{lang|grc|Philia}} should become {{lang|grc-latn|Philia}} or {{transl|grc|Philia}}, that is a place I have a hard time judging. For *now*, I'm looking for insource:/lang\|grc\|[a-z]/i , but I know that isn't the end of the issue. (looking for a greek letter and a latin letter next to each other gets a *lot* of hits, ranging from ΦBK to all greek words where the writer is using a Latin C in place of a Capital lunate Sigma.Naraht (talk) 02:40, 11 June 2026 (UTC)
- I think they meant that if you use Greek words then they should be written in Greek alphabet and not in Latin alphabet. If this error check can happen, it should probably be for other non-Latin langauges (he, ar, etc.) Gonnym (talk) 18:28, 10 June 2026 (UTC)
Template-protected edit request on 24 June 2026
[edit]This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
In the "When using {{lang}} with non-English wiktionary links" part, include something like "{{wikt-lang}} is a template to do this". For example, maybe place that exact verbiage after the example, or perhaps make that first bit "When using {{lang}} with non-English wiktionary links (see {{wikt-lang}}): " Dingolover6969 (talk) 22:11, 24 June 2026 (UTC)
Not done: according to the page's protection level, you should be able to edit the page yourself. If you seem to be unable to, please reopen the request with further details. – Jonesey95 (talk) 22:15, 24 June 2026 (UTC)
- Oh, you're right. I was looking at the template itself, not its documentation page. Dingolover6969 (talk) 22:19, 24 June 2026 (UTC)
styling of japanese romaji
[edit]nurikabe (ja) is written in some weird font (at least on my browser) but, eg, nurikabe (fr) is written normal. The former is undesirable. It seems ja-Latn fixes the problem nurikabe, but couldn't this be done automatically? This is a low priority request and I'm not going to personally fix it, to be sure. Dingolover6969 (talk) 22:18, 24 June 2026 (UTC)
ill-lang?
[edit]I've started a discussion about potential "ill-lang" functionality over at Template_talk:Interlanguage_link#ill-lang?, feel free to join in. Dingolover6969 (talk) 01:47, 2 July 2026 (UTC)
Protected edit request on 14 July 2026
[edit]This edit request to Module:Lang has been answered. Set the |answered= parameter to no to reactivate your request. |
Current version of Module:Lang:
local function make_error_span (template, msg)
return table.concat ({'<span style="color:var(--color-error,#d33)">', cfg.misc_text_t.error, ': ', template, msg, '</span>'})
end
Requested change:
local function make_error_span (template, msg)
return table.concat ({'<span class="error" style="color:var(--color-error,#d33)">', cfg.misc_text_t.error, ': ', template, msg, '</span>'})
end
Rationale: the {{#iferror:}} parser function evaluates to true if the input string contains an HTML object with class="error". This change adds the class to any soft errors thrown by this module (listed at Category:Lang and lang-xx template errors).
I want to change some of the script-specific templates such as {{Script/Greek}} (which adds script styling) so that they call {{Lang}} if an optional language code has been provided. Since the script is the whole point of the template, it would first try calling Lang with the language code [langcode]-Grek, but this will raise a soft error if the language's default script is Grek, so I want to be able to fall back to calling Lang without the script code appended if that happens. Theknightwho (talk) 14:20, 14 July 2026 (UTC) Theknightwho (talk) 14:20, 14 July 2026 (UTC)
- Did you test this proposal? Where? If I write variations of the current and proposed markup to test the change, I get:
<span style="color:var(--color-error,#d33)">the current error message</span>→ the current error message<span class="error" style="color:var(--color-error,#d33)">the proposed error message</span>→ the proposed error message
- —Trappist the monk (talk) 14:59, 14 July 2026 (UTC)
Multiple languages support
[edit]I think it would be beneficial to add the option for multiple iterations of the code parameter for labeling text with more than one language, something like (code1 = de|code2 = fr) that would render as "German and French: lorum ipsum" -- Lenny Marks (talk) 18:38, 20 July 2026 (UTC)
- This has come up before. See Template talk:Lang/Archive 14 § a way to mark something as being in multiple languages.
- To add to the previous discussion, when you write:
{{langx|de|lorum ipsum}}
- the template creates this html so that browsers choose a correct font and screen readers pronounce the text with the correct accents.
[[German language|German]]: <i lang="de">lorum ipsum</i>
- html allows only one
lang=attribute in an element (<i>in this case) so we cannot get html to tell browsers to render the text in different fonts nor tell screen readers to pronouncify lorum ipsum in both the German and French accents. - We do have
{{native name list}}which can do this:{{native name list |tag1=de |name1=lorum ipsum |tag2=fr |name2=lorum ipsum}}
- —Trappist the monk (talk) 19:13, 20 July 2026 (UTC)