Template talk:Lang

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

This template is protected be cause it is used a lot - vandalism would be visible on hundreds of wikis on several hundred thousand pages. Also, editing a template causes every page that uses the template to be re-rendered, causing massive server load. So, discuss below, test elsewhere, and keep edits to a minimum. -- Duesentrieb(?!) 13:57, 1 February 2007 (UTC)[reply]


Class

[edit]

This template now puts two classes on a piece of text. Is this intented? Now it adds "description" and "the language". Might be useful to have something like

class="description-{{{1}}}

or

class="i18n-description i18n-description-{{{1}}}">

. Multichill (talk) 12:11, 27 November 2008 (UTC)[reply]

als

[edit]

{{editprotected}} Bitte hinzufügen: Template:Insignia/als. Danke, --Strommops ð 19:30, 26 August 2009 (UTC)[reply]

✓ Done That should have gone to Template talk:Insignia/lang, but OK, I’ve updated that template. --Mormegil (talk) 20:20, 26 August 2009 (UTC)[reply]

lang

[edit]

xml:lang is now added automatically by the MediaWiki software. Sanitizer.php no longer passes it, so the 'lang' parameter is redundant. --Gadget850 (talk) 18:10, 29 September 2013 (UTC)[reply]

I agree, but the redundant attribute is xml:lang="", just keep lang="".
Also, for correct inclusion of text in a foreign language, tagging the language is not sufficient, we should use a "bdi" HTML element instead of just a "span", so that changes of writing direction will be constrained inside it and will not alter the direction of the text outside (the entire bdi element will be transparent). In addition descriptions has absolutely no style associated to it by stylesheets in commons.
the class description should better be external, generated by other templates that really generate descriptions
Also I don't understand why it forces the CSS class description when this template is not just intended to be used only in descriptions, but as well in headings, legends below images, table cells, button captions, table captions, or values in infoboxes... where its associated style may break the layout.
However the CSS classname homonym to the language code is useful for browers that can't use lang() selectors for styling appropriate fonts for that language (notably with South-East Asian scripts).
So: remove xml:lang="" and description, and replace span by bdi. Thanks. verdy_p (talk) 23:22, 20 April 2015 (UTC)[reply]

Add option to use div tag instead of span tag

[edit]

{{Edit request}} Could Template:Lang/sandbox be copied over to Template:Lang. The update adds an option to use a different tag, such as a div tag, instead of span tag. diff. -- WOSlinker (talk) 19:25, 22 January 2018 (UTC)[reply]

Hello WOSlinker, why, example usage? -- User: Perhelion 21:10, 6 February 2018 (UTC)[reply]
I did have some uses but can't find them at the moment. -- WOSlinker (talk) 22:49, 16 February 2018 (UTC)[reply]
Found an exmaple. If you look at Template:Quality image, the text that is passed over to the lang template contains multiple lines, so the mediawiki software converts that into p tags, which it then mis-orders in the tidy processing (can be seen by viewing thr raw html at Special:ExpandTemplates). The solution is to either remove all linefeeds in the text passed over to lang or two allow the use of a div tag rather than a span. -- WOSlinker (talk) 16:37, 20 February 2018 (UTC)[reply]
I'm not convinced this edit is needed. For any administrator: This template used on nearly every file on Commons so your edit will be noticed. Multichill (talk) 18:09, 20 February 2018 (UTC)[reply]
I'm also not convinced this edit is needed. May be a better solution would be to request fixes to tidy processing? --Jarekt (talk) 14:06, 22 February 2018 (UTC)[reply]
Are there cases where span has any advantage over div (i.e., why we actually need the option)? DMacks (talk) 18:48, 9 May 2018 (UTC)[reply]
Regarding the now-becoming-urgent need to fix, see Commons:Village_pump#Tech_News:_2018-19. DMacks (talk) 18:53, 9 May 2018 (UTC)[reply]
✓ Done I'm doing this so commons won't go broken in the very near future. --Zhuyifei1999 (talk) 23:51, 9 May 2018 (UTC)[reply]
I'm finding more places in need of using div than span. I'm gonna switch to div by default and see what breaks. --Zhuyifei1999 (talk) 00:07, 10 May 2018 (UTC)[reply]
If we add style="display:inline;", we have the default wanted span beavior with div tag. E.g.:User_talk:Zhuyifei1999 #template:lang_on_commons. So we can remove the recource hungry (if we look at the usage, wasting) tag parameter again. @DMacks, Jarekt, Multichill, WOSlinker, and Zhuyifei1999: An block beavior is not expectable, if used on some words only. -- User: Perhelion 10:58, 27 August 2018 (UTC)[reply]
Make sense. --Zhuyifei1999 (talk) 13:50, 27 August 2018 (UTC)[reply]
I have no opinion, just make sure you don't break Commons ;-) Multichill (talk) 15:18, 27 August 2018 (UTC)[reply]
User:Zhuyifei1999, The current lang template behavior on commons break textes since the end of august month Popolon (talk) 00:34, 6 September 2018 (UTC)[reply]
I've done the change for the first... -- User: Perhelion 06:23, 6 September 2018 (UTC)[reply]
@Perhelion: It appears that the CSS fix doesn't work on Commons:When to use the PD-signature tag#China, People's Republic of due to MediaWiki putting the <div> tag outside of the <p> tags. -Einstein95 (talk) 08:15, 6 April 2019 (UTC)[reply]
Indeed, if the template is used on the top most level. But I 'm not sure to re-add the tag parameter. In fact this template has not the same usage as en:Template:Lang (only inline). So theoretically/technically the template should be split, as changing the tag which makes up the whole template, is absolutely not optimal. I guess also a better parameter name would be simply "inline" (as other templates/keywords). So a fix on the page would be to indent the lines with ":". -- User: Perhelion 13:15, 6 April 2019 (UTC)[reply]

dir

[edit]

{{Editprotected}}

I’ve prepared a change in the sandbox which adds the dir HTML attribute (and also removes the now-useless xml:lang, if we’re already at it). I know this may impact site performance, but it helps avoiding bad layout like of the translated tag template of Template:Essay/i18n/ar, where the English text’s exclamation mark is before the sentence, because that text block is marked as right-to-left through its ancestors. The same error may happen with right-to-left languages in left-to-right context. ({{Dir}} is also kept low-cost, as it’s also widely used already, so it’s maybe not that bad.) —Tacsipacsi (talk) 11:59, 23 June 2019 (UTC)[reply]

✓ Done. 4nn1l2 (talk) 12:11, 23 June 2019 (UTC)[reply]

tag

[edit]

{{Editprotected}}

|tag= is documented as working, and apparently you can provide either div or span as a value. Except, it doesn't work, and the template hard codes div. Please fix. Psiĥedelisto (talk) 09:40, 25 June 2020 (UTC)[reply]

I also agree. The "div" should be changed into "bdi", so that it works for inline or block contents indifferently (no need then to use custom CSS to force the inline style, which still does not work with the wiki parser that jsut sees a "div" and thinks it is an end of block and breaks paragraphs or lists: the wiki does not parse the CSS... So now we can no longer tag the language of a title or word given in the middle of a paragraph: Mediawiki "sees" the "div" and terminates the current paragraph, then inserts the content of this template, ten reopens a new paragraph just after it for the end of sentence). This edit made by admin was clearly wrong, never tested, based on false assumptions.
Initially there was a "tag= parameter to select the teag to use ("tag=div" or tag="span", "div" was its default) but it has unexpectedly removed by some admin at end of 2018, then blocking it...
I do not request restoring the parameter (even though if it is restored, its default should be "tag=bdi") but at least change the "div" into "bdi" (the parameter is then usually not needed, except that it could also be "p", or "li", or "blockquote", or "q"...) So replace div by bdi (and then remove the unneeded CSS style display:inline which is incorrect for tags that must remain block elements). verdy_p (talk) 23:41, 4 July 2020 (UTC)[reply]
Unfortunately simply changing to <bdi> will cause issues the other way round: as it’s an inline element, it could cause problems with embedding block elements (multi-paragraph texts, <div>s, tables etc.). The only solid solution is restoring the possibility to use real block elements (<div>) as well as real inline elements (<span>/<bdi>). Tacsipacsi (talk) 00:20, 5 July 2020 (UTC)[reply]
It already cause problem as adding carriage return, before and after the text :(. This is not the behaviour on other wiki. It will probably should be simpler to copy-paste the code from en: wiki for example ? Popolon (talk) 13:32, 12 July 2020 (UTC)[reply]

I would like to return to the original proposal and the prior functioning of this template, namely, the restoration of the parameter |tag= which would allow a user to specify ‎<div>...‎</div> or ‎<span>...‎</span>. I also propose that the current style="display:inline;" be removed, as it doesn't work and would cause problems if it did. Daask (talk) 02:33, 23 July 2022 (UTC)[reply]

Admins, please do. The template is (literally) unusable for inline content in its current state. M!dgard (talk) 20:42, 18 June 2023 (UTC)[reply]
In the meantime I created {{LangS}}. M!dgard (talk) 20:46, 18 June 2023 (UTC)[reply]
 Not done This template is used on ~60M pages, and I do not think it should be touched. If other templates are needed for slightly different purposes please create new templates. --Jarekt (talk) 01:51, 22 May 2024 (UTC)[reply]

Bug

[edit]

Bug on this page: 김치. P.T.Đ (talk) 13:10, 6 November 2021 (UTC)[reply]

Fixed with switch to {{LangS}}. --Jarekt (talk) 01:53, 22 May 2024 (UTC)[reply]

Addition of "description"-class (in 2006)

[edit]

This change from 2006 is mentioned in phab:T373979#10207670.

It appears to lead to issues in later tools, see Commons:Village_pump/Technical#Templates_in_description_field_bug.
 ∞∞ Enhancing999 (talk) 08:48, 26 November 2024 (UTC)[reply]