Template talk:Language with name/for

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Uses[edit]

@Hyacinth: what uses does this template have? No policy or guideline suggests this should be used. I see no obvious accessibility features (such as those offered by Template:lang concerning screen readers). Does this simply produce a wikilink to the language and transclude the word "for"?— Preceding unsigned comment added by Finnusertop (talkcontribs) 14:35, 13 February 2016 (UTC)[reply]

Yes, that's precisely what it does -- and it's extremely useful (not to mention gramatically correct) in preference to Template:lang, in situations where it is needed. I would like to see a "no-link" feature added to this template, such that the language name appears optionally only as a word. I'd also like to see quote marks added by default around the word or phrase being translated.
For example, consider the opening sentence of this featured article:
Musca (Latin: fly) is a small constellation in the deep southern sky.
Musca (Error: {{language with name/for}}: missing language tag or language name (help)) is a small constellation in the deep southern sky.
The first implies that "fly" is Latin for "Musca". The second clarifies what we really meant -- that "Musca" is Latin for "fly".— Hugh (talk) 01:30, 21 December 2017 (UTC)[reply]
Umm, |links=no:
{{Language with name/for|2=Latin|3="[[fly]]"|links=no}}Error: {{language with name/for}}: missing language tag or language name (help)
Trappist the monk (talk) 01:44, 21 December 2017 (UTC)[reply]
Thanks! I hadn't read the docs closely enough. I still think the quote marks should be there by default -- you shouldn't have to add them manually. — Hugh (talk) 02:22, 21 December 2017 (UTC)[reply]
WP:SOFIXIT. I would recommend single quote to match the rendering style of the |translation= parameter used in the {{lang-??}} templates. Cleanup shouldn't be too onerous since there are only about 200 transclusions of this template.
Trappist the monk (talk) 10:31, 21 December 2017 (UTC)[reply]
I replicated your fix on today's main page so now this template is cascade protected but that should go away in the normal course.
Trappist the monk (talk) 10:49, 21 December 2017 (UTC)[reply]

Thank you. I attempted to make these changes and also add some TemplateData, but it doesn't appear to have worked so I reverted my changes. Can you please help? Thanks! — Hugh (talk) 19:59, 21 December 2017 (UTC)[reply]

I think that what you wanted to do is something like this (quote marks around {{{3}}}):
}} for {{#if:{{{1|}}}|{{Lang|{{{1|}}}|'{{{3}}}'|rtl={{{rtl|}}}}}|'{{{3}}}'}}
But, looking at that, I have to wonder why the {{lang}} template is there. It appears that most instances of this template are written in one of two forms (ignoring redirects):
  1. {{Language with name/for||language|text}}
  2. {{Language with name/for|2=language|3=text}}
the empty positional parameter (same as the omitted |1=) is {{{1|}}} in the snippet of code above. Even if editors wrote template instances with that first positional parameter, the result would very likely be wrong if the point of this template is to identify the preceding text as some-other-language-than-English and text as the English translation. So, at best, {{{1|}}} or |1= should be en which makes the {{lang}} template markup text as English text (in the English Wikipedia) which is all pointless.
If all of that gibberish is right, then perhaps what it is that you really want is something like this:
}} for '{{{3}}}'
we don't care about the |rtl= parameter because English has no use for it.
The next step, of course, is to complete the task by removing extraneous quote marks from the templates in article space. After that, ending the need for the empty parameter or the need to use |2= and |3= is, I think, the final step. Semi-automated editing tools like WP:AWB would be helpful in these tasks.
Trappist the monk (talk) 20:50, 21 December 2017 (UTC)[reply]

Language codes[edit]

Why does this template only accept the name of the language (e.g. German) instead of language codes (e.g. de)? Other templates like {{Lang}}, {{In lang}}, citation templates and infoboxes accept ISO codes, for good reasons I assume. – Finnusertop (talkcontribs) 14:15, 1 March 2023 (UTC)[reply]

The template does accept language tags but in doing so it produces unexpected results; cf (taken from the example of the template's doc page):
federal state of ''Thüringen'' {{langnf||German|Thuringia}} → federal state of Thüringen Error: {{language with name/for}}: missing language tag or language name (help)
federal state of ''Thüringen'' {{langnf|de|German|Thuringia}} → federal state of Thüringen German (German for 'Thuringia')
Notice in the rendering of the second example that the 'for' word is italicized; if you mouse over that word you get a tooltip that says 'German-language text'. That makes no sense to me. Further, the word 'Thüringen' (outside of the template) is German so it should be wrapped in a {{lang}} template.
The obvious simple fix is to remove the call to {{lang}} and use {{{1}}} as a preferred alternate to {{{2}}}. An awb script might then be written to rewrite existing templates to add the appropriate language tag and delete the language name. Sometime down the road perhaps the template could be rewritten so that {{{2}}} is the lead-in word (Thüringen in the above examples):
federal state of {{langnf|de|Thüringen|Thuringia}}
federal state of {{lang|de|Thüringen}} ({{lang|fn=name_from_tag|de|link=yes}} for 'Thuringia')
federal state of Thüringen (German for 'Thuringia')
{{{2}}} would always be optional so that other stuff (IPA etc) could be inserted between the non-English term and the {{langnf}} template. When {{{2}}} is omitted, the automatic parentheses would be suppressed.
Trappist the monk (talk) 15:19, 1 March 2023 (UTC)[reply]
I have hacked the sandbox to make the obvious simple fix described above:
{{Language with name/for/sandbox||German|Thuringia}}Error: {{language with name/for}}: missing language tag or language name (help)
{{Language with name/for/sandbox|de|German|Thuringia}}German (German for 'Thuringia')
{{Language with name/for/sandbox|de||Thuringia}}German for 'Thuringia'
|links=no
{{Language with name/for/sandbox||German|Thuringia|links=no}}Error: {{language with name/for}}: missing language tag or language name (help)
{{Language with name/for/sandbox|de|German|Thuringia|links=no}}German (German for 'Thuringia')
{{Language with name/for/sandbox|de||Thuringia|links=no}} → German for 'Thuringia'
term in italics:
{{Language with name/for/sandbox||German|''Thuringia''}}Error: {{language with name/for}}: missing language tag or language name (help)
{{Language with name/for/sandbox|de|German|''Thuringia''}}German (German for 'Thuringia')
{{Language with name/for/sandbox|de||''Thuringia''}}German for 'Thuringia'
If this is acceptable, I'll update the live template.
—16:36, 1 March 2023 (UTC)Trappist the monk (talk)
There having been no comment, I have updated the live template from its sandbox. Category:Pages with Langnf using second positional parameter tracks {{Language with name/for}} templates that use {{{2}}} (language name). Templates on those pages should be fixed so that {{{1}}} has the correct language tag and {{{2}}} is blank.
Trappist the monk (talk) 23:09, 4 March 2023 (UTC)[reply]