Jump to content

Template talk:Pg

Add topic
From Meta, a Wikimedia project coordination wiki
Latest comment: 1 year ago by Aymatth2 in topic Documentation

Documentation[edit]

@Benipal hardarshan, @Tacsipacsi: Hi! Please could you document what this template does? I'm having a difficult time understanding it via just looking at the wikitext. Thanks! (And thank you Tacsipacsi for your improvements that led me here!) Quiddity (WMF) (talk) 18:42, 30 September 2021 (UTC)Reply

@Quiddity (WMF): It was copied from Commons, where it’s extensively documented. However, that documentation doesn’t seem to be 100% accurate (it doesn’t mention the special casing of parameters starting with a colon; there may be other inaccuracies as well), so I don’t want to import it in order to prevent this inaccuracy from spreading. —Tacsipacsi (talk) 23:24, 30 September 2021 (UTC)Reply
@Quiddity (WMF) and Tacsipacsi: I'm also a bit confused about this template. It seems to be similar to {{ll}} but with a bit of a different usage? I can't even really tell what the short name is mean to mean — is it "page" without the vowels? :-) SWilson (WMF) (talk) 00:56, 21 June 2022 (UTC)Reply
@SWilson (WMF): Yes, it’s similar to {{ll}}, but builds on a different assumption: {{ll}} assumes that the user most likely wants to read pages in their user interface language, while this one assumes that the user most likely wants to continue reading in the same language as the current page is in. {{ll}}’s assumption fails if the UI language is not properly set (e.g. an occasional reader of Meta doesn’t take the time to change the default of English) or if the user fluently speaks multiple languages and sometimes reads in one language, other times in the other. This template’s assumption fails when the current page is not translated (either because it’s an untranslatable page—like a talk page—, or because not all pages are translated into all languages due to volunteers translating, not staff), or when it is translated, but its technical page language is not properly set (this can happen only when the page is translated the legacy manual way, the Translate extension always properly sets the page language). So this template should never be used on talk pages and manually translated pages (and in templates transcluded in such pages), while on pages translated using the extension both templates have their advantages and disadvantages; I prefer this template on such pages.
I don’t know what the name is meant to mean—I’m not the original author, it’s Aymatth2—, but I also assume it’s “page”. —Tacsipacsi (talk) 11:40, 25 June 2022 (UTC)Reply
  • The name "pg" is short for "page". It formats a link to a target page.
  • {{Pg}} is for use in translatable pages in the Wikimedia Commons and Help namespaces. It is preferred in these namespaces to {{localized link}}.
  • When a user is browsing through Commons or Help documentation, {{pg}} tries to keep them on pages in their current selection of language as long as possible, falling back if needed to their preferred language and then to English. Thus a user who prefers a poorly supported language such as Asturian may choose to browse documentation in Spanish. {{Pg}} will link them from page to page in Spanish, while {{Localized link}} would repeatedly try to link to an Asturian version, fail, and fall back to English.
  • If the current page is in English, {{pg|pagename}} will have the same effect as [[pagename]]. If the user is viewing a page in a language other than English and selects a link, they will be taken to a version of the target page in the same language if available, failing that in their preference language, and failing that in English.
  • I think there are some twists when the link includes an anchor in the page, and when it is used in namespaces other than Commons or Help, but it has been three years since the template was upgraded to use a Lua module, and I lost track at that point. Aymatth2 (talk) 14:34, 25 June 2022 (UTC)Reply