Template talk:Taginfo2
Code review
@ZeLonewolf: I took the liberty of making a couple messages and numbers localizable. Apart from that, here are a couple things that need attention before going live:
- Template:TaginfoAJAX and User:ZeLonewolf/taginfo.js appear to rely pretty heavily on
id
s, which makes it risky to embed a template for the same tag multiple times on the same page. (IDs are supposed to be unique.) Let's try to rely onclass
es or relative selectors as much as possible. – Minh Nguyễn 💬 06:50, 3 January 2021 (UTC)
- Resolved: Templates/scripts have all been converted to class-based selectors --ZeLonewolf (talk) 02:29, 4 January 2021 (UTC)
- The
taginfo-hidden
spans add some hidden text to the page. If CSS happens to be turned off for some reason, these strings will show. It also isn't great for screen reader accessibility, to the extent that we're concerned about it. MediaWiki supports HTML5 data attributes, so you can store this text in e.g.data-ti-error="…"
on the outermost tag, which is cleaner and avoids these issues. – Minh Nguyễn 💬 06:50, 3 January 2021 (UTC)
- Resolved: Error messages have been converted to use HTML5 data items --ZeLonewolf (talk) 00:16, 9 January 2021 (UTC)
- I replaced
Number.prototype.toLocaleString()
withmw.language.convertNumber()
, so if your browser is set to English but your wiki preferences are set to French, you'll see French-formatted numbers alongside the French-language messages. Unfortunately, this library doesn't provide percentage formatting (which differs between English and French and other languages). Fortunately, MediaWiki:Percent provides the percentage format, but we'll have to stuff it in one of those data attributes on one of the tags. – Minh Nguyễn 💬 06:50, 3 January 2021 (UTC)
- Resolved: Percentages now use the i18n percent template! --ZeLonewolf (talk) 00:16, 9 January 2021 (UTC)
- User:ZeLonewolf/taginfo.js uses an arrow function, which isn't supported by Internet Explorer 11. MediaWiki still supports IE 11 at grade A (meaning it loads JavaScript), but this unsupported syntax will prevent any JavaScript-based features from working. I don't know how much this wiki specifically cares about IE 11; we haven't really needed to think about browser compatibility before, because we haven't done extensive gadget and user script development here. – Minh Nguyễn 💬 06:50, 3 January 2021 (UTC)
- Resolved: Arrow functions have been replaced with traditional function calls. --ZeLonewolf (talk) 02:40, 4 January 2021 (UTC)
- How does the script handle relations whose members predominantly have no role, such as on Relation:route_master? – Minh Nguyễn 💬 07:06, 3 January 2021 (UTC)
- How's this? --ZeLonewolf (talk) 02:27, 4 January 2021 (UTC)
- @ZeLonewolf: Looks good! I created MediaWiki:Taginfo-empty-role so that bit can be localized too. – Minh Nguyễn 💬 10:10, 4 January 2021 (UTC)
- Resolved: Empty roles are implemented --ZeLonewolf (talk) 20:29, 9 January 2021 (UTC)
Displaying
First of all a big thank you for the effort to create an improving replacement for taginfo template! Two first impressions:
I notice, the new displays need more space than old ones. That leeds to once more longer tables. Perhaps the layout or formating could be tuned again to save space.
In mobile view of the Wiki there occur some issues for me (Firefox Android): large whitespaces, not all % symbols are shown, overlapping text if rotating device. Chris2map (talk) 14:36, 3 January 2021 (UTC)
- Thanks for the review! I was thinking that we could make the tag name, "powered by taginfo", and "all types count" suppressible, which would give you up to 3 rows back. I'll have to take a look on mobile to see what's going on re: strange display artifacts. --ZeLonewolf (talk) 14:42, 3 January 2021 (UTC)
- These optional parameters would be good. Maybe one to show the "all types count" only? --Chris2map (talk) 17:31, 3 January 2021 (UTC)
- Done. Each part of this (tag link, taginfo link, percentages, node/way/relation/all counts) can be individually disabled.
- Layout should look good on mobile, I switched all of the sizings to em. --ZeLonewolf (talk) 02:08, 4 January 2021 (UTC)
- When the box is only showing the grand total and not the header, it should still have a link to taginfo as a courtesy and a way to get the full details. – Minh Nguyễn 💬 00:19, 5 January 2021 (UTC)
That is a point. Perhaps the icons could link to the tag on taginfo (rather hidden). Or the "all counts" is in bold text and works as link at the same time.
I suggest to rename parameter taginfoLink into footer. It's clearer / easier to understand IMO. -- Chris2map (talk) 12:49, 5 January 2021 (UTC)
- The link parameter is now "footer" --ZeLonewolf (talk) 00:24, 9 January 2021 (UTC)
- Resolved: footer is implemented, and icons now link to taginfo. --ZeLonewolf (talk) 20:29, 9 January 2021 (UTC)
Alternative Taginfo instances
Would it be an idea to be able to report national statistics from separate instances of Taginfo? --Andrew (talk) 20:20, 4 January 2021 (UTC)
- Can you describe what you mean by that? Are there multiple instances of taginfo? It would certainly be possible to parameterize a URL for an alternative taginfo instance. --ZeLonewolf (talk) 20:23, 4 January 2021 (UTC)
- For example https://taginfo.openstreetmap.org.uk/ reports a British subset of the data, Taginfo/Sites has more. --Andrew (talk) 21:41, 4 January 2021 (UTC)
- Resolved: The url parameter allows you to specify a different taginfo instance. --ZeLonewolf (talk) 03:23, 9 January 2021 (UTC)
How it works?
Looking at the template code I have no idea at all how it works or even where API is called. Is it maybe possible to document it a bit? At least the part that it makes API calls on each page load (it works this way, right?) What #tag:osmtaginfo is doing and where it is defined and so on would be also nice. Mateusz Konieczny (talk) 10:05, 11 January 2021 (UTC)
- How's this? Template:Taginfo2/doc#See_also.
The code for osmtaginfo is here.--ZeLonewolf (talk) 03:25, 12 January 2021 (UTC)- Taginfo/Embedding describes iframe method that was used in the old template, not here (as far as I know/remember). Or is iframe used in both? Mateusz Konieczny (talk) 09:09, 12 January 2021 (UTC)
- After a number of discussions, we've now removed the osmtaginfo call entirely. If javascript is not present, a simple link to the tag's taginfo page will be presented. There are no longer any iframe elements, it's all pure javascript loading via AJAX calls. --ZeLonewolf (talk) 02:12, 27 January 2021 (UTC)
Breaks formatting in and out when not used alone
A separate line/paragraph is needed for it to work. Some of the numbers go as far as to display an error.
Bullet-list:
Numbered list:
Table:
Header text | Header text |
---|---|
Indent:
Don't know whether this is intended. If not easily fixable, a workaround would be helpful enough.
-- Kovposch (talk) 16:50, 27 April 2021 (UTC)
- @Kovposch: Fixed in Template:Taginfo2, Template:TaginfoAJAX, and Template:TaginfoAJAX relation. – Minh Nguyễn 💬 07:50, 20 November 2021 (UTC)
in other languages
Is this template translatable? maro21 17:31, 29 May 2021 (UTC)
- @Maro21: Yes, the messages used by this template are translatable as part of the interface. If you provide the language code and the text to use for each of these messages, an administrator can take care of adding the localization for you. – Minh Nguyễn 💬 09:20, 17 November 2021 (UTC)
- Cool! I will provide translations soon. maro21 16:20, 17 November 2021 (UTC)
- Minh Nguyen, I've prepared Polish translation. Could you create it in free time? Thank you in advance! maro21 16:18, 25 November 2021 (UTC)
- Cool! I will provide translations soon. maro21 16:20, 17 November 2021 (UTC)
- MediaWiki:Taginfo-all/pl
Wszystko
- MediaWiki:Taginfo-nodes/pl
Węzły
- MediaWiki:Taginfo-ways/pl
Linie
- MediaWiki:Taginfo-relations/pl
Relacje
- MediaWiki:Taginfo-all-count/pl
Liczba obiektów z tagiem „$1=$2” w bazie
- MediaWiki:Taginfo-node-count/pl
Liczba węzłów z tagiem „$1=$2” w bazie
- MediaWiki:Taginfo-way-count/pl
Liczba linii z tagiem „$1=$2” w bazie
- MediaWiki:Taginfo-relation-count/pl
Liczba relacji z tagiem „$1=$2” w bazie
- MediaWiki:Taginfo-all-fraction/pl
Ułamek wszystkich obiektów z kluczem „$1”
- MediaWiki:Taginfo-node-fraction/pl
Ułamek wszystkich węzłów z kluczem „$1”
- MediaWiki:Taginfo-way-fraction/pl
Ułamek wszystkich linii z kluczem „$1”
- MediaWiki:Taginfo-relation-fraction/pl
Ułamek wszystkich relacji z kluczem „$1”
- MediaWiki:Taginfo-header-relation/pl
Relacja $1
- MediaWiki:Taginfo-members/pl
Człony relacji
- MediaWiki:Taginfo-member-count/pl
Człony relacji „$1” w bazie
- MediaWiki:Taginfo-prevalent-roles/pl
Dominujące role:
- MediaWiki:Taginfo-empty-role/pl
(bez roli)
- MediaWiki:Taginfo-powered-by/pl
[$1 Więcej na $2]
- MediaWiki:Taginfo-no-such-tag/pl
Ten tag nie występuje w bazie OSM.
- MediaWiki:Taginfo-error/pl
Błąd ładowania z API Taginfo.
@Maro21: All set, thanks for the translations! – Minh Nguyễn 💬 22:06, 25 November 2021 (UTC)
--
Could you please add the German translation? See below. --Thanks, Chris2map (talk) 14:15, 7 January 2022 (UTC)
- MediaWiki:Taginfo-all/de
Total
- MediaWiki:Taginfo-nodes/de
Knoten
- MediaWiki:Taginfo-ways/de
Linien
- MediaWiki:Taginfo-relations/de
Relationen
- MediaWiki:Taginfo-all-count/de
Objekte mit Attribut „$1=$2” in der Datenbank
- MediaWiki:Taginfo-node-count/de
Knoten mit Attribut „$1=$2” in der Datenbank
- MediaWiki:Taginfo-way-count/de
Linien mit Attribut „$1=$2” in der Datenbank
- MediaWiki:Taginfo-relation-count/de
Relationen mit Attribut „$1=$2” in der Datenbank
- MediaWiki:Taginfo-all-fraction/de
Anteil an allen Objekten mit Schlüssel „$1”
- MediaWiki:Taginfo-node-fraction/de
Anteil an allen Knoten mit Schlüssel „$1”
- MediaWiki:Taginfo-way-fraction/de
Anteil an allen Linien mit Schlüssel „$1”
- MediaWiki:Taginfo-relation-fraction/de
Anteil an allen Relationen mit Schlüssel „$1”
- MediaWiki:Taginfo-header-relation/de
Relation $1
- MediaWiki:Taginfo-members/de
Mitglieder
- MediaWiki:Taginfo-member-count/de
Mitglieder der „$1”-Relationen in der Datenbank
- MediaWiki:Taginfo-prevalent-roles/de
Vorherrschende Rollen:
- MediaWiki:Taginfo-empty-role/de
(leere Rolle)
- MediaWiki:Taginfo-powered-by/de
[$1 Mehr auf $2]
- MediaWiki:Taginfo-no-such-tag/de
Attribut kommt in der OSM-Datenbank nicht vor.
- MediaWiki:Taginfo-error/de
Fehler bei Abruf von Taginfo-API.
- @Chris2map: All set, thanks for the translations! – Minh Nguyễn 💬 22:23, 22 January 2022 (UTC)
Spaced values
Values are cut-off at whitespaces. Eg note:generator:type=CPV (concentrator photovoltaic) becomes note:generator:type=CPV. Demo:
-- Kovposch (talk) 15:47, 3 October 2021 (UTC)
I also have this problem.
Demo 1: brand="Coop Marked" becomes "Coop", and the text is broken.
Demo 2: brand="Ditt Apotek" does not work, and the text is broken.
--NKA (talk) 11:23, 15 November 2021 (UTC)
@Kovposch and NKA: I fixed Template:TaginfoAJAX, Template:TaginfoAJAX relation, and MediaWiki:Gadget-taginfo.js to properly escape and unescape the taginfo parameters for HTML and JavaScript:
– Minh Nguyễn 💬 01:49, 19 November 2021 (UTC)
Relation members
How can I display information about relation members?
{{Taginfo2|relation|route}} shows info about the tag relation=route
and {{Taginfo2|type|route}} shows only basic info without members. maro21 16:41, 17 November 2021 (UTC)
{{taginfo2|rtype=route}}
– Minh Nguyễn 💬 00:38, 19 November 2021 (UTC)
Not functioning with Convenient Discussions
Only links to "More details at taginfo". Have to edit in source. See history.
-- Kovposch (talk) 04:40, 12 January 2022 (UTC)
- ---- Kovposch (talk) 04:43, 12 January 2022 (UTC)
- @Kovposch: It seems to be working for me, just not in the live preview. It would be possible to make the template work in the live preview, but we’d probably have to cache the results somehow to avoid hammering the taginfo API every time it refreshes. – Minh Nguyễn 💬 22:28, 22 January 2022 (UTC)
hover text
I think there should be a hover text (alt text? I don't know how it's called) in case of long key names, for example:
So instead of letter "s" we can see "..." - the letter would fit here. But in case of even longer keys, there should be a hover text.
maro21 19:47, 23 March 2022 (UTC)
- For me, a hover text does actually appear when hovering over the tag (Safari, macOS). Kjon (talk) 19:53, 23 March 2022 (UTC)
- So it looks like it doesn't work on Firefox. maro21 20:22, 23 March 2022 (UTC)
- I don't have a hover in Firefox either. And neither under MS Edge. --Chris2map (talk) 08:44, 26 March 2022 (UTC)
- No hovertext is visible in Google Chrome. Use the title attribute for the link... (https://tipps.computerbild.de/internet/webdesign/a-href-title-864367.html). --Reneman (talk) 09:42, 25 April 2022 (UTC)
- @Maro21 and Kjon: This behavior is specific to Safari. [1] It's a cool feature. As a workaround for other browsers, including other WebKit-based browsers, I've added a
title
attribute to the links in the header: Special:Diff/2330997, Special:Diff/2330998. – Minh Nguyễn 💬 00:20, 30 May 2022 (UTC)Resolved
- @Maro21 and Kjon: This behavior is specific to Safari. [1] It's a cool feature. As a workaround for other browsers, including other WebKit-based browsers, I've added a
not true?
When the value of a tag is "true", it displays only the footer (which, in addition, disappears after loading the entire page):
and another template used after it on the same page is not visible:
Change also "building|true" to "building|false" in my message, use Preview and see what'll happen. maro21 21:20, 31 March 2022 (UTC)
- No April Fool, unfortunately. Any number causes same behaviour as "true". And with "false" there is shown the total amount of usage of the key. --Chris2map (talk) 11:52, 1 April 2022 (UTC)
- I tried to find a quick workaround Template:Sandbox&oldid=2306458 but it didn't do. I suspect the Javascript MediaWiki:Gadget-taginfo.js understands the "true" wrong. --Chris2map (talk) 18:42, 2 April 2022 (UTC)
- For some reason, it works when used with Template:Description (and by adding |type=value or |type=key), see Sandbox&oldid=2326998 The RedBurn (talk) 15:48, 21 May 2022 (UTC)
- Resolved: Should be resolved now. – Minh Nguyễn 💬 19:21, 27 May 2022 (UTC)
No numeric values
Similar problem: {{Taginfo2|maxspeed|100}}
shows:
--Chris2map (talk) 18:42, 2 April 2022 (UTC)
- Not resolved for "0":
- maro21 21:35, 21 May 2022 (UTC)
- Resolved: Special:Diff/2330118 – Minh Nguyễn 💬 19:20, 27 May 2022 (UTC)
Values: false, NaN
The parameters of the template should be treated as string, but they're not:
maro21 21:35, 21 May 2022 (UTC)
- Resolved: Special:Diff/2330118 – Minh Nguyễn 💬 19:20, 27 May 2022 (UTC)
Replace #tag:osmtaginfo with Taginfo2 in Template:Description
Is there any plan to replace #tag:osmtaginfo with Taginfo2 in Template:Description? The RedBurn (talk) 09:28, 19 May 2022 (UTC)
- We've been currently waiting for a significant bug to be fixed (see section above). So the answer is: not yet. maro21 23:03, 19 May 2022 (UTC)
- Is there still any outstanding issue or is it ready for deployment? The RedBurn (talk) 06:56, 16 July 2022 (UTC)
- I've done the replacement. It seems fine on Template:Description/testcases. Feel free to revert if there's any issue and please mention them here. The RedBurn (talk) 13:29, 2 August 2022 (UTC)
- Is there still any outstanding issue or is it ready for deployment? The RedBurn (talk) 06:56, 16 July 2022 (UTC)
Old discussion on Talk:Wiki
For reference: Talk:Wiki/Archive_8#New_Taginfo_Replacement The RedBurn (talk) 13:24, 2 August 2022 (UTC)
Tags commonly used with suffixes
I think it would be nice to have the option to display accumulated statistics for tags commonly used with suffixes. E.g. having one box with the combined usage count of "maxspeed", "maxspeed:backward" and "maxspeed:forward". Maybe a version of the template could accept a list of keys and sum them up? --Mueschel (talk) 14:43, 19 May 2023 (UTC)
Additional link "More details at taginfo"
If a tag doesn't appear in the OSM database, the template shows additional link "More details at taginfo" at the bottom. example. It doesn't show this link when the tag is used: example. But it also doesn't show the link if on the same page is used the template with used tag! example. maro21 20:49, 24 May 2023 (UTC)
- @Maro21: Fixed. These examples were helpful, thanks! – Minh Nguyễn 💬 18:52, 14 July 2023 (UTC)
alignment in the table
What is interesting is the behavior of this template when I apply right or left alignment in the table. Only the link that appears before the template loads and the text "This tag does not appear in the OSM database." are aligned, but not the numbers or the box... Is it a bug or feature? maro21 23:50, 13 February 2024 (UTC)
text-align: left | |
text-align: left | |
text-align: center | |
text-align: center | |
text-align: right | |
text-align: right |
Refresh the page or use Preview a few times to see the aligned link. maro21 23:50, 13 February 2024 (UTC)
- @Maro21: The usual contents of the box are in an HTML table, whereas the no-results and error messages and the non-JavaScript fallback link are all inline text that would inherit the containing block's
text-align
property. – Minh Nguyễn 💬 19:38, 11 April 2024 (UTC)
- Then it's a bug or feature? maro21 16:11, 17 April 2024 (UTC)
- @Maro21: Call it a suboptimal design, I suppose.
:^)
Feel free to prototype a fix in Template:Taginfo2/sandbox or Special:MyPage/Gadget-taginfo.css. – Minh Nguyễn 💬 00:11, 25 May 2024 (UTC)
- @Maro21: Call it a suboptimal design, I suppose.
Way-Icon has link
The way icon of the template (eg. on https://wiki.openstreetmap.org/wiki/Template:Taginfo2) creates a broken link like https://wiki.openstreetmap.org/wiki//tags/highway%3Dresidential
. The other icons do link to taginfo correctly. --Tordans (talk) 13:29, 13 May 2024 (UTC)
- I fixed it.
- I think there should be no links on icons at all. Because the links to a particular tag on Taginfo are already both in the header and in the footer. So in total there are as many as 6 links. @Minh Nguyen: can we remove the links? maro21 16:37, 24 May 2024 (UTC)
- @Maro21: Thanks for fixing it. I think the links were intended to mimic what the old taginfo extension generated. We can easily delink the icons – maybe we should even turn the images into background images via CSS instead of embedding them like wiki images – but it might be tricky because we still need to link the icon if you hide the other links using |tagLink = no and |footer = no. – Minh Nguyễn 💬 00:01, 25 May 2024 (UTC)
- Oh, I forgot about templates without a footer and header, so we need links: maro21 14:29, 25 May 2024 (UTC)