Template talk:Current leader
Add topic| This is the talk page for discussing improvements to the Current leader template. |
|
| To help centralize discussions and keep related topics together, the talk pages for all modules and templates related to {{Current leader}} redirect here. |
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
another way
[edit]Following on from discussions at Wikipedia:Help desk § Synonyms/aliases in Lua modules and Wikipedia:Village pump (idea lab) § Idea for series of World leader templates
It occurred to me that leader names are likely kept in wikidata. Of the handful of countries that I checked (admittedly not many) all had head of state (P35) and head of government (P6) properties. So I hacked a module at Module:Sandbox/trappist the monk/current leader. The code in that module is only meant to be run from the debug console but could be adapted for use with this template. Instead of maintaining lists of names, Module:Current leader/data would hold a list of country-names and aliases mapped to the country's qid at wikidata:
return { ['afghanistan'] = 'Q889', ['afg'] = 'Q889', ['af'] = 'Q889', ['albania'] = 'Q222', ['alb'] = 'Q222', ['al'] = 'Q222', ... }
Module:Current leader would fetch the qid for the country specified in {{{1}}} from ~/data and use that qid to fetch the name(s) associated with the country's head of state or government as specified in {{{2}}} from wikidata. Implementation details will need to be worked out...
—Trappist the monk (talk) 22:39, 16 May 2026 (UTC)
- I can see the benefits of doing this, however if this template becomes widely used it will likely be protected in some way. Wouldn't using Wikidata would allow vandalism to circumvent the protection? While Wikidata is more obscure than Wikipedia, vandalism does happen over there. I could imagine a scenario where someone changes the name of a politician they dislike to a perjorative on Wikidata, and this ending up spreading across Wikipedia wherever the template is used. It may not even necessarily be done to intentionally bypass the protection. Someone may simply make a small petty edit on Wikidata, with the unintended side effect of that edit being echoed here on Wikipedia. – Scyrme (talk) 03:07, 17 May 2026 (UTC)
- @PharaohCrab and Chaotic Enby: What do you think of Trappist's suggestion? Should we continue adding to the data module, or should we implement this instead? – Scyrme (talk) 05:02, 18 May 2026 (UTC)
- I agree with Scyrme here that this suggestion leaves the template to open to vandalism and would prefer continued development of the data module. PharaohCrab speak𓀁 works𓀨 11:20, 18 May 2026 (UTC)
- I like having more interconnection! Getting more folks aware of Wikidata is a good thing, although it might be less intuitive for new editors to update when reverting vandalism – but so is a Lua data module, to be fair. There is, in fact, a way to add an edit icon encouraging people to fix these with {{Wikidata}}, so maybe that could be an option?Having the data stored on Wikidata could also motivate people to add sources there, as most data points are still unsourced.We don't even need a full database of Wikidata correspondences as {{Wikidata}} can already map Wikipedia page titles to Wikidata items (although that feature is marked as expensive). For example,
{{Wikidata|property|:Afghanistan|P35}}returns Hibatullah Akhundzada, and we can even customize it further with{{Wikidata|property|linked|edit|:Afghanistan|P35}}which gives you Hibatullah Akhundzada
.The only "issue" is for multiple heads of state: doing {{Wikidata|property|linked|edit|:Bosnia and Herzegovina|P35}}only returns the first one to be marked as current (here, Željko Komšić
), so you need to do {{Wikidata|properties|linked|edit|:Bosnia and Herzegovina|P35}}: Željko Komšić, Denis Bećirović, Željka Cvijanović
which returns all those marked as current. Using properties instead of property in general works with both single and multiple heads of state. Chaotic Enby (talk · contribs) 14:31, 18 May 2026 (UTC)
- I've made this much simpler implementation in Template:Current leader/sandbox. Chaotic Enby (talk · contribs) 15:09, 18 May 2026 (UTC)
- @Chaotic Enby: Is there a way to make this Wikidata-based version take aliases for countries and titles? – Scyrme (talk) 03:49, 27 May 2026 (UTC)
- Not as far as I know, it can only output the item (country) aliases, and the property (title) aliases that can be used as input are limited. Chaotic Enby (in solidarity · talk · contribs) 13:13, 27 May 2026 (UTC)
- Seems like the non-Wikidata approach offers more flexibility then, unless there's a workaround. – Scyrme (talk) 13:32, 27 May 2026 (UTC)
- Code the aliases outside of Wikidata, but still call in Wikidata for the data itself, which will still be much shorter (and need less maintenance) than having everything outside Wikidata. Chaotic Enby (in solidarity · talk · contribs) 14:00, 27 May 2026 (UTC)
- So there's a workaround? What needs doing with the data module to make that work? – Scyrme (talk/solidarity) 14:09, 27 May 2026 (UTC)
- Pretty much looping back to Trappist's original suggestion of listing the aliases in the datamodule but not the data itself. Chaotic Enby (in solidarity · talk · contribs) 14:21, 27 May 2026 (UTC)
- The same format? "
return {['alias'] = 'QID',...}"? – Scyrme (talk/solidarity) 14:25, 27 May 2026 (UTC)- Yep, and have property aliases alongside that. You can directly pass on QIDs in {{Wikidata}}. Chaotic Enby (in solidarity · talk · contribs) 14:34, 27 May 2026 (UTC)
- Wait, since Wikidata has separate properties for head of state/government and their specific titles, wouldn't that mean any title, even an incorrect title, would work? Like I could ask the template for the current king of China or the president of the United Kingdom and it would give me their respective heads of state. – Scyrme (talk/solidarity) 15:03, 27 May 2026 (UTC)
- Now realizing that this could be a bigger issue in cases like Iran where the head of government is titled "President". Chaotic Enby (in solidarity · talk · contribs) 16:03, 27 May 2026 (UTC)
- @Chaotic Enby and PharaohCrab: So are we going ahead with the original plan in light of this issue? I've been holding off on adding to the data module in case the plan changed to use Wikidata (which would make the existing module redundant), but I see PharaohCrab has continued to add to the module. – Scyrme (talk/solidarity) 16:55, 29 May 2026 (UTC)
- Now realizing that this could be a bigger issue in cases like Iran where the head of government is titled "President". Chaotic Enby (in solidarity · talk · contribs) 16:03, 27 May 2026 (UTC)
- Wait, since Wikidata has separate properties for head of state/government and their specific titles, wouldn't that mean any title, even an incorrect title, would work? Like I could ask the template for the current king of China or the president of the United Kingdom and it would give me their respective heads of state. – Scyrme (talk/solidarity) 15:03, 27 May 2026 (UTC)
- Yep, and have property aliases alongside that. You can directly pass on QIDs in {{Wikidata}}. Chaotic Enby (in solidarity · talk · contribs) 14:34, 27 May 2026 (UTC)
- The same format? "
- Pretty much looping back to Trappist's original suggestion of listing the aliases in the datamodule but not the data itself. Chaotic Enby (in solidarity · talk · contribs) 14:21, 27 May 2026 (UTC)
- So there's a workaround? What needs doing with the data module to make that work? – Scyrme (talk/solidarity) 14:09, 27 May 2026 (UTC)
- Code the aliases outside of Wikidata, but still call in Wikidata for the data itself, which will still be much shorter (and need less maintenance) than having everything outside Wikidata. Chaotic Enby (in solidarity · talk · contribs) 14:00, 27 May 2026 (UTC)
- Seems like the non-Wikidata approach offers more flexibility then, unless there's a workaround. – Scyrme (talk) 13:32, 27 May 2026 (UTC)
- Not as far as I know, it can only output the item (country) aliases, and the property (title) aliases that can be used as input are limited. Chaotic Enby (in solidarity · talk · contribs) 13:13, 27 May 2026 (UTC)
- @Chaotic Enby: Is there a way to make this Wikidata-based version take aliases for countries and titles? – Scyrme (talk) 03:49, 27 May 2026 (UTC)
- I've made this much simpler implementation in Template:Current leader/sandbox. Chaotic Enby (talk · contribs) 15:09, 18 May 2026 (UTC)
- Looks like we are. Chaotic Enby (in solidarity · talk · contribs) 17:24, 29 May 2026 (UTC)
- I've filled out the data module, however, it turns out there's a hard maximum limit of 200 local variables, so the module needs to be reorganised to allow it to function. For the moment, I've commented out most of the entries for U and V so I could submit the additions. – Scyrme (talk/solidarity) 17:36, 3 June 2026 (UTC)
- Try this:
local country_data = { abkhazia = { ['head of state'] = 'Badra Gunba', ['president'] = 'Badra Gunba', ['head of government'] = 'Vladimir Delba', ['prime minister'] = 'Vladimir Delba', } afghanistan = { ['head of state'] = 'Hibatullah Akhundzada', ['supreme leader'] = 'Hibatullah Akhundzada', ['head of government'] = 'Hasan Akhund', ['prime minister'] = 'Hasan Akhund', } ... } return { -- A ['abkhazia'] = country_data.abkhazia, ['afghanistan'] = country_data.afghanistan, ['afg'] = country_data.afghanistan, ['af'] = country_data.afghanistan, ... }
- —Trappist the monk (talk) 17:56, 3 June 2026 (UTC)
- I'll give it a try now. – Scyrme (talk/solidarity) 18:19, 3 June 2026 (UTC)
- @Trappist the monk: Seems to work as intended, after adding commas after closing braces. Thanks for the suggestion! – Scyrme (talk/solidarity) 18:38, 3 June 2026 (UTC)
- I'll give it a try now. – Scyrme (talk/solidarity) 18:19, 3 June 2026 (UTC)
- Try this:
- I've filled out the data module, however, it turns out there's a hard maximum limit of 200 local variables, so the module needs to be reorganised to allow it to function. For the moment, I've commented out most of the entries for U and V so I could submit the additions. – Scyrme (talk/solidarity) 17:36, 3 June 2026 (UTC)
@Chaotic Enby and PharaohCrab: What's next? – Scyrme (talk/solidarity) 10:05, 4 June 2026 (UTC)
- well this template seems to be ready for limited implementation so that should probably be the next course of action, starting with List of current heads of state and government PharaohCrab speak𓀁 works𓀨 11:18, 4 June 2026 (UTC)
we need a better solution for pages with disambiguators
[edit]Some of the leaders here have pages with disambiguators which can be a problem, this previously was brought up in the Village pump discussion that led the the creation of this template where @Scyrme suggested piping the link on the individual page using the disambiguated parameter but that does not seem like a good situation as not only is it more complicated then I a feel it should be but it also defeats the would purpose of this template, that purpose being to avoid having to update many pages every time a leader changes. PharaohCrab speak𓀁 works𓀨 15:29, 4 June 2026 (UTC)
- I have assemble a list of leaders on this list who need to be disambiguate
- Disambiguation with parentheses (politicians)
- Kim Min-seok (politician) – Kim Min-seok
- Mohammad Mustafa (politician) – Mohammad Mustafa
- Patrick Allen (governor-general) – Patrick Allen
- Philip Davis (Bahamian politician) – Philip Davis
- Stanley John (politician) – Stanley John
- Disambiguation without parentheses (monarchs)
- Albert II, Prince of Monaco – Albert II
- Alois, Hereditary Prince of Liechtenstein – Alois
- Guillaume V, Grand Duke of Luxembourg – Guillaume V
- Mohammed VI of Morocco – Mohammed VI
- Philippe of Belgium – Philippe
- Salman of Saudi Arabia – Salman
- PharaohCrab speak𓀁 works𓀨 15:51, 4 June 2026 (UTC)
- One idea would be to list these entries as
[Article title] | [Displayed title]
in the data module, and program the module to ignore the| [Displayed title]
part if|link=nois set. I'm not sure if that's actually possible. Might be doable with regex that searches for the pipe character and a following string of letters and spaces. A cruder way to do this would be to duplicate the data entries with two datasets, one of which has article titles and the other has display titles, and have Module:Current leader produce both if|link=is unset (or set to "yes"), but produce only the display title if|link=nois set. Ideally, the module would default to the data entered into the article title data if no entries exists in the display title data, so only the disambiguated titles need to be duplicated. These are just ideas. There may be a better solution. – Scyrme (talk/solidarity) 18:05, 4 June 2026 (UTC)
- One idea would be to list these entries as
- Consider Module:Current leader/sandbox (see Template:Current leader/testcases).
- The Monaco and Saudi Arabia tests between live and ~/sandbox fail (correctly). The South Korea tests pass (incorrectly). The South Korea test 'passes' because line 630 in Module:Current_leader/data incorrectly omits the article disambiguator.
- —Trappist the monk (talk) 19:21, 4 June 2026 (UTC)
- that is an easy fix, thanks for all your help on this template. PharaohCrab speak𓀁 works𓀨 19:35, 4 June 2026 (UTC)
- I have fixed the data Module there, all disambiguated leaders should work in the sandbox version now PharaohCrab speak𓀁 works𓀨 14:08, 5 June 2026 (UTC)
- @Trappist the monk: Great, thank-you! Am I right that this erases disambiguators by searching for either parentheses, a comma, or the word "of" and then deleting it along with anything that follows? – Scyrme (talk/solidarity) 22:00, 4 June 2026 (UTC)
- Yeah, except that the patterns for parenthetical and 'of' dabs require a leading space and the 'of' must be followed by a space.
- —Trappist the monk (talk) 00:19, 5 June 2026 (UTC)
- Thanks. Makes sense that it also amends the spacing appropriately. I was asking so I could note this in the documentation, in case it needs to be amended if it causes unexpected issues later for whatever reason or there's a pattern of disambiguation that these rules don't account for. I've now done so. Feel free to amend it. – Scyrme (talk/solidarity) 18:22, 5 June 2026 (UTC)
- the module still doesn't have disambiguation support, only the sandbox version does PharaohCrab speak𓀁 works𓀨 18:02, 6 June 2026 (UTC)
- I've synced the module with its sandbox, as I see no reason not to do so given it seems to work as intended. We could always revert later if we need to fallback to the previous version. – Scyrme (talk/solidarity) 18:13, 6 June 2026 (UTC)
- the module still doesn't have disambiguation support, only the sandbox version does PharaohCrab speak𓀁 works𓀨 18:02, 6 June 2026 (UTC)
- Thanks. Makes sense that it also amends the spacing appropriately. I was asking so I could note this in the documentation, in case it needs to be amended if it causes unexpected issues later for whatever reason or there's a pattern of disambiguation that these rules don't account for. I've now done so. Feel free to amend it. – Scyrme (talk/solidarity) 18:22, 5 June 2026 (UTC)
- that is an easy fix, thanks for all your help on this template. PharaohCrab speak𓀁 works𓀨 19:35, 4 June 2026 (UTC)
Templates this could easily replace
[edit]I've tried to find the existing templates which could be easily replaced by this one. These existing templates produce simply the name of the incumbent with no parameters, except one which includes "President". Since the title "President" doesn't change frequently and doesn't vary with gender, it would probably be safe for this to be handled wherever the template is transcluded instead of by the template itself. Two of these would require broadening the scope of the leaders included in the data module.
- {{Current chairperson of the Barbuda Council}} (would require adding this role to Module:Current leader/data)
- {{Current president of Bangladesh}} (includes the title "President")
- {{Current president of Slovenia}} (this template seems to be unused)
- {{Current prime minister of Antigua and Barbuda}}
- {{Incumbent pope}} (includes a non-breaking space between the name and numeral)
- {{Incumbent POTUS}}
- {{Incumbent VPOTUS}} (would require including the vice-president in Module:Current leader/data)
Please add to the list above if I've missed any. – Scyrme (talk/solidarity) 21:51, 6 June 2026 (UTC)
- A few of templates I found with a similar function I excluded from the list above because they had many parameters and additional functions which exceed the scope of the new template. These templates were {{Monarch of New Zealand, current}}, {{Current UK monarch}}, and {{Current Ulu-o-Tokelau}}. – Scyrme (talk/solidarity) 21:57, 6 June 2026 (UTC)
- definitely seems like most of these could be replaced, we can probably get around to doing that and then deleting the depreciated templates. PharaohCrab speak𓀁 works𓀨 22:31, 6 June 2026 (UTC)
- I've converted the Slovenia, POTUS, and Antigua and Barbuda templates to use Module:Current leader. In future, the uses of these templates can be substituted, but for now they share the same underlying modules. I've also converted the Bangladesh template to use the module for the name, though it still includes the title so {{Current leader}} isn't a drop-in replacement. It could become one if either {{Current leader}} is expanded to have a parameter for displaying titles or if the title is removed from the Bangladesh template and instead inserted in all the articles where the template is transcluded. I'm not sure if we want to add the chairperson of the Barbuda Council to the data module, so I haven't done the same for that template though it would be equally easy to do. Likewise for VPOTUS. I've not converted the Pope template as it's protected and I don't have the permissions. It would require an edit request, which would probably only be fulfilled after a discussion to establish consensus to handle Popes via the module. – Scyrme (talk/solidarity) 14:20, 6 July 2026 (UTC)
- definitely seems like most of these could be replaced, we can probably get around to doing that and then deleting the depreciated templates. PharaohCrab speak𓀁 works𓀨 22:31, 6 June 2026 (UTC)
error handling
[edit]There are a couple of TODOs in Module:Current leader. I have addressed them in Module:Current leader/sandbox and Module:Current leader/data/sandbox. See Template:Current leader/testcases.
Without there is objection, I shall update the live modules from their sandboxen.
inverted names
[edit]The recent additions of inverted country names to Module:Current leader/data (here and here) got me wondering if that were necessary. Seems rather a maintenance headache to make sure that all invertible country names have matching inverted names.
There seem to be two common forms of inversion:
korea, republic of→republic of koreacomoros, union of the→union of the comorosandbahamas, the→the bahamas
It seems to me that when {{current leader}} is given an inverted country name, Module:Current leader could un-invert that name to use as the indexer when doing the leader-name lookup. So I hacked an uninvert() function in my sandbox at lines 71–88. The function commas() will fetch inverted country names taken from Module:Current leader/data/sandbox (at this writing in sync with the live ~/data module), uninvert() them, and render a crude list of both names. In the debug console write: =p.commas() to see the list.
Am I missing summat? Is there a need for inverted country names in ~/data?
—Trappist the monk (talk) 13:37, 8 June 2026 (UTC)
- if you have a way to automatically invert names then by all means implement it, I added the inverted names because they are often the names used by international organisations. PharaohCrab speak𓀁 works𓀨 15:49, 8 June 2026 (UTC)
- Code added to the sandbox and all inverted names removed from ~/data/sandbox.
{{current leader/sandbox|korea, republic of|head of state}}→ Lee Jae Myung{{current leader/sandbox|comoros, union of the|head of state}}→ Azali Assoumani{{current leader/sandbox|bahamas, the|head of state}}→ Charles III
- I will update the live modules sometime today unless someone beats me to it.
- —Trappist the monk (talk) 18:39, 8 June 2026 (UTC)
- done; also includes the error handling fix.
- —Trappist the monk (talk) 23:58, 8 June 2026 (UTC)
- Code added to the sandbox and all inverted names removed from ~/data/sandbox.
revised synonyms table
[edit]I have revised how Module:Current leader/data lists country-name synonyms. Compare the live module with the sandbox module. I think that the ~/sandbox construct makes it easier for editors to understand and maintain.
Mapping country_synonyms_list_t synonyms to country_data_t is handled by a small function synonyms_t_make ().
Keep? Discard?
—Trappist the monk (talk) 23:56, 9 June 2026 (UTC)
- There having been no comment, live module updated.
- —Trappist the monk (talk) 22:23, 19 June 2026 (UTC)
Presidency of Haiti vacant
[edit]@Trappist the monk There is currently no President of Haiti so it is listed here as "Vacant" and thus should never provide a link. Can this be fixed? PharaohCrab speak𓀁 works𓀨 01:52, 21 June 2026 (UTC)
- In the sandbox:
{{Current leader/sandbox|haiti |President}}→ vacant
- New table in Module:Current leader/data/sandbox lists office-holder names that will never be linked
- —Trappist the monk (talk) 12:44, 21 June 2026 (UTC)
- Seems to work so I see no reason not to bring it out of the sandbox. Maybe we could also add "Disputed" to the list? – Scyrme (talk/solidarity) 19:09, 12 July 2026 (UTC)
Navigation templates and surnames
[edit]There a several navigation templates that list political leaders, and these could be kept up-to-date using Module:Current leader. Some use full names, like {{Heads of state of republics}}, however, seemingly, most use surnames only (see eg. {{Current G20 leaders}}, {{Current heads of government}}). It may be helpful if this template and Module:Current leader could produce surnames only.
I'm unsure what the best way to implement this would be. Obviously this would need a parameter like |surnames=yes, but how should the modules be amended to handle this? Some ideas:
1. One option would be to redesign the data module so that instead of listing full names all names are given in the data as surnames and forenames, and Module:Current leader combines them to produce full names when |surnames=(unset). The advantage of this approach would be that it could also be used to implement a toggle to change the format of full names from Emmanuel Macron to Macron, Emmanuel if needed.
2. A simpler approach may be to duplicate all the data entries so ['president'] = 'Mohammed Shahabuddin', is paired with ['president surname'] = 'Shahabuddin', and so on. Module:Current leader would then treat |surnames=yes as equivalent to entering the title parameter as "president surname" etc. Or Module:Current leader could be left unchanged, and we could add an instruction to the documentation to append the word "surname" to a title if that's desired. Feels much more clumsy and cobbled together to do it this way though.
3. Another option would be to have Module:Current leader interpret |surname=yes as (by default) calling for the last sequence of letters in a name, distinguished by spaces. This would work for most surnames. For those surnames which are exceptions to this pattern we could come up with a way to add an override, like explicitly stating something like prime minister surname length = 2
for "De Wever". Alternatively, the exceptions could be handled by regex patterns which identify terms like "de", "van", "von", "bin", "ibn", "bint", etc. as the beginning of a surname. I'm uncertain if such a regex-based approach could be trusted to always work reliably for all names. Regardless of how exceptions are handled, this would save on having to massively add to the data module. Hypothetically, the inverse of the same rule could also be used to implement reformatting names as Macron, Emmanuel.
4. Finally, another approach would be to forget about trying to distinguish surnames from forenames, and instead have a new parameter like |show names= which takes a number and produces however many are specified. So |show names=1 would take a name like Bart Albert Liliane De Wever
and produce Wever
, while |show names=3 would produce Liliane De Wever
, etc. It would be up to the editors using the template or invoking the module to specify the correct number. This approach wouldn't help with reformatting names, but wouldn't require any handling of exceptions or expansions of the data module.
@Trappist the monk, PharaohCrab, and Chaotic Enby: Any thoughts or better ideas? – Scyrme (talk/solidarity) 13:52, 12 July 2026 (UTC)
- Having separate first name and surname fields would be helpful, but we have to take into consideration cultures where surnames aren't necessarily in use (e.g. Iceland, Ethiopia, Indonesia all using patronymics to some extent), or how to deal with royals who are known on a first name basis. Automatically cutting the names will also add a hurdles for cultures where surnames come first, like China.Still, we could have a "default" as described in option 3, which will work in the majority of cases, and additional data fields for the more specific cases described above instead of following regex rules, which will likely end up becoming overcomplicated due to all the cultural subtleties (e.g. France has specific rules on when "de" goes with the surname or not). Chaotic Enby (in solidarity · talk · contribs) 14:46, 12 July 2026 (UTC)
- (edit conflict)
- A variant on #1:
['head of whatever'] = {'Bart De Wever', family = 'De Wever', given = 'Bart'},['head of whatever'] = {'Xi Jinping', family = 'Xi', given = 'Jinping', fam_first = true},
- The template gets a new parameter:
|format=. In the general case (|format=omitted or empty), the module fetches['head of whatever'][1]('Bart De Wever', 'Xi Jinping'). - Values assigned to
|format=are:|format=family– the module fetches['head of whatever'].family('De Wever', 'Xi') and returned that|format=invert– the module fetches['head of whatever'].family('De Wever', 'Xi') and['head of whatever'].given('Bart', 'Jinping'). Whennot ['head of whatever'].fam_first, the module returns <family>, <given> ('De Wever, Bart'); else it returns <family> <given> ('Xi Jinping') because 'Xi, Jinping' (with the separator) is incorrect.
- —Trappist the monk (talk) 15:26, 12 July 2026 (UTC)
- Seems like this approach would make it possible to use
|format=givento fetch['head of whatever'].givento return 'Bart', 'Jinping', etc. If so, that would help with the case of cultures where only patronymics are used without surnames, since in these naming conventions generally a person is referred to by their given name not by their patronymic. For example, Kristrún Frostadóttir is shortened to Kristrún not Frostadóttir, though it should still invert to Frostadóttir, Kristrún. It would probably be better to use the termsfirst =andlast =instead ofgiven =andfamily =, to encompass varying naming conventions and to be consistent with the parameters used by other templates (eg. citation templates which use|first=and|last=for authors). Practically what matters is that the name can be partitioned and inverted correctly, and that the parts can be displayed separately if needed, rather than the specifics of whether a particular name is a "family name", "patronymic", "laqab", etc. so "first" and "last" is probably good enough for our purposes. – Scyrme (talk/solidarity) 15:59, 12 July 2026 (UTC)- Thinking about it, to minimise having to update the uses of the template, it may help to have an option for
|format=shortwhich would follow:['head of whatever'] = {'Kristrún Frostadóttir', last = 'Frostadóttir', first = 'Kristrún', short = first},with|format=shortreturningKristrún
, and|format=invertreturningFrostadóttir, Kristrún
.['head of whatever'] = {'Xi Jinping', last = 'Xi', first = 'Jinping', short = last, last_first = true},with|format=shortreturningXi
, and|format=invertreturningXi Jinping
.['head of whatever'] = {'Catherine Connolly', last = 'Connolly', first = 'Catherine', short = last},with|format=shortreturningConnolly
, and|format=invertreturningConnolly, Catherine
.
- Would this be workable? – Scyrme (talk/solidarity) 16:12, 12 July 2026 (UTC)
- Perhaps
short = lastcan be the default, so it wouldn't need to be explicitly specified in the data module. – Scyrme (talk/solidarity) 16:13, 12 July 2026 (UTC)- Yep, that sounds like the most efficient way to go at it. In most cases (Western name format with a single first name and last name), we could even have automatic defaults for
firstandlast, to minimize effort required to update the names. Chaotic Enby (in solidarity · talk · contribs) 18:37, 12 July 2026 (UTC)- Another thing to consider is what to do about the collective entries, like Switzerland or Bosnia and Herzegovina. How would it be formatted? Would the following work, or would something else be needed?
['heads of state'] = {'Denis Bećirović', 'Željka Cvijanović', 'Željko Komšić', last1 = 'Bećirović', last2 = 'Cvijanović', last3 = 'Komšić', first1 = 'Denis', first2 = 'Željka', first3 = 'Željko'},I'm unsure if this would also necessitate being able to setshort = firstandlast_first = truefor individual names (short1 =,short2 =, etc.), if that's even possible, or if having these apply to all names would be good enough. – Scyrme (talk/solidarity) 17:16, 13 July 2026 (UTC)- Not that way. Compare lines 247–252 against line 253. Here is how those render using the sandbox:
- singular 'head' (lines 247–252)
{{Current_leader/sandbox|bosnia|head of state}}{{Current_leader/sandbox|bosnia|head of state|format=invert}}{{Current_leader/sandbox|bosnia|head of state|format=short}}- Bećirović, Cvijanović and Komšić
- plural 'heads' (line 253) – these all same because line 253 is 'old-form'
{{Current_leader/sandbox|bosnia|head of state}}{{Current_leader/sandbox|bosnia|head of state|format=invert}}{{Current_leader/sandbox|bosnia|head of state|format=short}}- Bećirović, Cvijanović and Komšić
- In its current form, the sandbox defaults to
short='last'. It is possible to writeshort='first'in the data module (who knows mayhaps that's necessary). When the sequentially 'last' name is not to be used for the short name, the sandbox uses the name specified in short. For example, see line 110 which gives this result when|format=short: - —Trappist the monk (talk) 19:34, 13 July 2026 (UTC)
- Not that way. Compare lines 247–252 against line 253. Here is how those render using the sandbox:
- Another thing to consider is what to do about the collective entries, like Switzerland or Bosnia and Herzegovina. How would it be formatted? Would the following work, or would something else be needed?
- Yep, that sounds like the most efficient way to go at it. In most cases (Western name format with a single first name and last name), we could even have automatic defaults for
- Perhaps
- Thinking about it, to minimise having to update the uses of the template, it may help to have an option for
- Seems like this approach would make it possible to use
- Implemented in the sandbox, I think. See ~/testcases.
- —Trappist the monk (talk) 17:26, 14 July 2026 (UTC)
- Thanks for this! The testcases appear to work as intended, so I've begun switching to the new data format in the sandbox. I wasn't quite sure how to handle the Vatican's entry. I initially used
first = 'Leo XIV', short = 'first'but re-simplified it after I noticed the note regarding formats. When converting it I also noticed that the full name doesn't follow the guidance to use the name exactly as it appears in the article title because the article title includes the title "Pope", not just a name. See § Popes include 'Pope' in their article titles. – Scyrme (talk/solidarity) 01:39, 22 July 2026 (UTC)- I've gone ahead and done converted all entries to the new format. Feel free to check and correct my work where appropriate. I particularly wasn't sure what to do regarding Bhutan, since typically there are no surnames/family names/patronymics/etc, only given names. However, royalty do have a dynastic name which now seems to function as last name ('Wangchuck'). More accurately, both given names of Jigme Wangchuck are inherited by successive kings. The tradition seems to resemble the way Roman emperors would adopt the name of 'Augustus' or 'Julius Caesar' or both, in that these names were taken on to maintain political continuity, rather than being patronymics, surnames, family names, or any other common form of 'last name' in a modern sense. Feel free to amend the entries for Bhutan if there's a better way to handle them than what I did. – Scyrme (talk/solidarity) 02:01, 23 July 2026 (UTC)
- Thanks for this! The testcases appear to work as intended, so I've begun switching to the new data format in the sandbox. I wasn't quite sure how to handle the Vatican's entry. I initially used
Popes include 'Pope' in their article titles
[edit]
Articles for Popes usually include the title "Pope" in the article title, as in Pope Leo XIV. This results in the linked named being a redirect as in [[Leo XIV]]. This is undesirable if this is to be used to automatically update, for example, navigation templates like {{Sovereigns of monarchies}}. That template is currently transcluded in the article Pope Leo XIV, and if the link were generated using {{current leader}} or its module it would not appear as bold text as intended when used at the target aticle, but would appear as a normal link to most readers because it actually links to the redirect Leo XIV rather than piping the link as [[Pope Leo XIV|Leo XIV]]. Since titles like "King", "Prince" and "Pope" sometimes appear as personal names (King (surname), Prince (surname), Pope (name)) using a regex approach to detecting and automatically omitting them wouldn't work. I'm not sure what the best fix would be.
Perhaps an override field could be added like article_title = 'Pope Leo XIV'. The default would still be to assume the name is identical to the article title, and the notes regarding updating the module would still instruct providing the name exactly as it appears in an article's title, with the omission of titles being the only exception. The new field would only be used for piping links, not changing the displayed name.
Alternatively, we could encourage following a format like providing the name as ['pope'] = {'Pope Leo XIV', first = 'Leo XIV', short = 'first', default_format = short}, to encourage following the general instruction to provide the name exactly as given by the article title, using something like default_format = to override and force the template to display a particular format (if the format is left unspecified by a template parameter). In this case, the short name would be piped using the full name as usual, and since the full name is given exactly as in the article title (including "Pope") the problem is averted. This would only work if we assume this is only likely to be a problem with people with mononyms (popes, other monarchs).
The first approach is the most flexible, but the second approach would better discourage misuse of something like article_title = to provide a name which differs from the article title unnecessarily, such as including additional middle names, including or omitting diacritics or hyphens arbitrarily, or using a different system of romanisation. – Scyrme (talk/solidarity) 01:09, 22 July 2026 (UTC)
- Did we not decide that the rule is to use the leader's exact article title with disambiguation? So, for Leo in the old format, the module data must be:
['head of state'] = 'Pope Leo XIV',
- The new format has the same requirement so:
['head of state'] = {'Pope Leo XIV'},
- Then, because
{{Sovereigns of monarchies}}wants the short form of the name, we change the new data format to:['head of state'] = {'Pope Leo XIV', short = 'Leo XIV'},
- and in
{{Sovereigns of monarchies}}write{{Current leader/sandbox|va|head of state|format=short}}
- which will render as:
[[Pope Leo XIV|Leo XIV]]
- so Leo's name in the navbox at Pope Leo XIV is bolded because of self-link as it should be (for the duration of his papacy).
- The more interesting and difficult issue is what to do during sede vacante. I don't have an answer for that yet.
- —Trappist the monk (talk) 11:29, 22 July 2026 (UTC)
- When Leo vacates the papacy, in the data module we set the Vatican City offices that he held:
['pope'] = {'Sede Vacante', short = ''},(probably best choice)
- or
['pope'] = 'Sede Vacante',
- To test this, I created the temporary Vatican City offices '_test' and '_test2' (they will go away):
['_test'] = 'Sede Vacante',['_test2'] = {'Sede Vacante', short = ''},
- Then we get these renderings from
{{Current leader/sandbox}}:{{Current leader/sandbox|va|_test|format=short}}→ {{Current leader}}: unknown office: _test<span style="color:var(--color-error, #bf3c2c)">{{[[Template:Current leader|Current leader]]}}: unknown office: _test</span>
{{Current leader/sandbox|va|_test2|format=short}}→ {{Current leader}}: unknown office: _test2<span style="color:var(--color-error, #bf3c2c)">{{[[Template:Current leader|Current leader]]}}: unknown office: _test2</span>
- —Trappist the monk (talk) 13:47, 22 July 2026 (UTC)
- Using
short =works and avoids having to add new functionality. It would mean that most of the time editors will have to remember to use|format=shortfor popes, but that's a minor issue. I'm happy to go with this for now; we can always change our minds later if we decide it'd be better to take a different approach. I agree that['pope'] = {'Sede Vacante', short = ''},is the best choice as this provides a reminder to use the 'short' field when the office is occupied and saves a bit of effort for future editors in retyping it. Though it should be either['pope'] = {'Sede vacante', short = ''},or['pope'] = {'sede vacante', short = ''},to avoid a redirect. I'm unsure if in general it'd be better to have non-names ('vacant', 'disputed', 'sede vacante') be all lowercase or start with a capital letter. Article titles don't distinguish the case of the first letter (though it's displayed as a capital), so both would link directly to the article. – Scyrme (talk/solidarity) 16:38, 22 July 2026 (UTC)- The only place that initial letter capitalization of
Sede vacantematters is in the rvalue at line 84 in the data module; not a place that most editors will be fiddling with. 'Sede Vacante' is incorrect. Should be 'Sede vacante' – second word lowercase. I've fixed that. - —Trappist the monk (talk) 17:32, 22 July 2026 (UTC)
- The only place that initial letter capitalization of
- Using
- When Leo vacates the papacy, in the data module we set the Vatican City offices that he held:
Mohamed al-Menfi?
[edit]{{current leader/sandbox|libya|head of state}} → Mohamed al-Menfi
{{current leader/sandbox|libya|head of state|format=invert}} → al-Menfi, Mohamed?
{{current leader/sandbox|libya|head of state|format=short}} → al-Menfi?
His article refers to him as al-Menfi. {{Heads of state of OPEC member states}} uses 'al-Menfi'. Which is it?
—Trappist the monk (talk) 00:32, 23 July 2026 (UTC)
- Some articles for people with Arabic names refer to them by their first names, but since the article uses al-Menfi perhaps Libya has adopted the Western convention of referring to people by their surnames? In this Arabic name the surname is al-Menfi. Regardless, it's best to be consistent with the article. As for the sandbox module, I muddled up Libya. I've corrected it now. – Scyrme (talk/solidarity) 01:38, 23 July 2026 (UTC)
Syncing
[edit]Besides checking that entries converted to the new format are as they should be, is there anything else that needs sorting out before the live versions of the modules can be synchronised with the sandboxes by importing changes from the sandboxes? – Scyrme (talk/solidarity) 12:55, 23 July 2026 (UTC)
- Have all of the issues that you have raised in this talk page been addressed? Satisfactorily?
- I guess I gotta wonder if using
short = 'first'is a good idea. When an office holder is replaced, editors will see the old names and replace those names with the new names. Becauseshort = 'first'does not contain an 'old' name, it may be left unmodified when it should have been – the new office-holder's short-form name is not their first name. I don't think that we need to remove support forshort = 'first'but we should probably begin with supplying the actual short-form name as a best practice:['head of state'] = {'Halla Tómasdóttir', last = 'Tómasdóttir', first = 'Halla', short = 'first'},
- becomes:
['head of state'] = {'Halla Tómasdóttir', last = 'Tómasdóttir', first = 'Halla', short = 'Halla'},
- —Trappist the monk (talk) 14:01, 23 July 2026 (UTC)
- Pinging Editor PharaohCrab who may not be aware of the new format but who has been periodically updating the live data module.
- —Trappist the monk (talk) 14:04, 23 July 2026 (UTC)
- @Trappist the monk: Regarding the issues that I raised, unless I've forgotten something, the only ones not yet addressed are those relating to wanting another editor to take a look at /data, particularly those entries not following Western naming conventions, to check I've handled them appropriately. Besides that, the only other thing is I'm not entirely convinced by your reply that the
only place that initial letter capitalization
matters is in the data module. If the template is to be usable in a sentence, then the initial letter case of the displayed form of non-names does matter. It seems to me that having non-names be all lowercase would allow them to be suitable in more contexts (if 'vacant' is displayed in an infobox instead of 'Vacant' it's not a problem; if 'Vacant is displayed mid-sentence it is a problem). Then again, maybe the template being usable in sentences isn't necessary. I'm honestly not sure, so I was hoping someone else would voice an opinion. Fair point regarding 'short'. I'm happy to have the guidance regarding updating the template encourage being specific if others agree. – Scyrme (talk/solidarity) 19:05, 24 July 2026 (UTC)- @PharaohCrab and Chaotic Enby: How do you feel about importing the changes from the sandbox into the live versions of the two modules? The testcases seem to be functioning as expected. – Scyrme (talk/solidarity) 21:36, 24 July 2026 (UTC)
- seems fine to me but I am slightly concerned that making the data module too complex will make it harder to update by less experienced editors. PharaohCrab speak𓀁 works𓀨 21:40, 24 July 2026 (UTC)
- I think the new format is still fairly straightforward, and hopefully the updated documentation I've drafted for the module will help clarify the nuances regarding varying from the basic format. (The draft is already in the source of the documentation page, but is commented out so isn't visible yet.) I don't expect there'll be any more major additions/changes to the format of the data module, so hopefully it won't get any more complicated than it is now. – Scyrme (talk/solidarity) 22:45, 24 July 2026 (UTC)
- No objections against it, seems to be understandable enough to maintain! Chaotic Enby (in solidarity · talk · contribs) 07:27, 25 July 2026 (UTC)
- I've gone ahead and sync'd the modules and published the draft of the documentation for /data. – Scyrme (talk/solidarity) 16:03, 25 July 2026 (UTC)
- seems fine to me but I am slightly concerned that making the data module too complex will make it harder to update by less experienced editors. PharaohCrab speak𓀁 works𓀨 21:40, 24 July 2026 (UTC)
- We might do this so that no matter where the template is placed, it is obvious that the returned text is a placeholder:
〈{{lang|la|[[Sede vacante]]}}〉→ 〈Sede vacante〉〈Vacant〉→ 〈Vacant〉〈Disputed〉→ 〈Disputed〉
- Would that suffice?
- Editor PharaohCrab made this edit and another editor made this change to the live ~/data module. These changes must be incorporated into the sandbox ~data module before synching.
- The Vatican City
_testand_test2entries should be deleted before synching. - Just for information, as I write this, this template is watched by 3 editors: you?, me, and one other... Not going to get much more help from the watchers so if there are better places to solicit input, you might want to post pointers to this discussion at those venues...
- —Trappist the monk (talk) 21:47, 24 July 2026 (UTC)
- @Trappist the monk: Adding the angled brackets to mark the text as a placeholder could work, though I've not really seen that done anywhere on Wikipedia so some editors may find it strange. Is there a reason not just use all lowercase? Would it be more difficult to implement? I've already incorporated the update made to Bangladesh into the sandbox; I'll sort out the other two later if no-one else does it first. – Scyrme (talk/solidarity) 23:06, 24 July 2026 (UTC)
- The module does not modify or apply any capitalization to the
vacant,disputed, orsede vacanteoutputs; it merely returns whatever editors give it in<country_data_t>or, forsede vacante, in<special_t>. I capitalizedSede vacantein<special_t>because that is how{{incumbent pope}}does it. - —Trappist the monk (talk) 13:07, 25 July 2026 (UTC)
- I've gone with lowercase for now as I don't see a disadvantage to doing so. It can be changed later if other editors would prefer an initial capital, as {{incumbent pope}} currently does, or if we find some problem I'm not aware of. – Scyrme (talk/solidarity) 16:19, 25 July 2026 (UTC)
- The module does not modify or apply any capitalization to the
- @Trappist the monk: Adding the angled brackets to mark the text as a placeholder could work, though I've not really seen that done anywhere on Wikipedia so some editors may find it strange. Is there a reason not just use all lowercase? Would it be more difficult to implement? I've already incorporated the update made to Bangladesh into the sandbox; I'll sort out the other two later if no-one else does it first. – Scyrme (talk/solidarity) 23:06, 24 July 2026 (UTC)
- @PharaohCrab and Chaotic Enby: How do you feel about importing the changes from the sandbox into the live versions of the two modules? The testcases seem to be functioning as expected. – Scyrme (talk/solidarity) 21:36, 24 July 2026 (UTC)
- @Trappist the monk: Regarding the issues that I raised, unless I've forgotten something, the only ones not yet addressed are those relating to wanting another editor to take a look at /data, particularly those entries not following Western naming conventions, to check I've handled them appropriately. Besides that, the only other thing is I'm not entirely convinced by your reply that the
Spaces in names with numerals/ordinals
[edit]
The documentation of {{Incumbent pope}} encourages using a non-breaking space before numerals, and this is what the template currently does. It formats the name as [[Pope Leo XIV|Leo XIV]]. Is there a way {{current leader}} could do the same?
A crude approach would be to use regex to find a string of multiple consecutive capital letters after a space and treat those as numerals, replacing the space with in the displayed text. In general, names don't have consecutive capital letters so these can safely be assumed to be numerals. A safer approach would limit the regex pattern to any string of capital I, V, or X (do any names include the numerals L, C, D, or M?) after a space. This would be less likely to be affected in the cases were a name includes a digraph and follows a native convention of capitalising all letters in the digraph at the beginning of name (such as IJ in Dutch, see eg. IJmuiden, though this is the name of town not a person). I think a regex pattern like %s[IVX]+ would work for this.
Perhaps there's a better approach than the one I suggested? – Scyrme (talk/solidarity) 19:33, 24 July 2026 (UTC)
- I don't think any of the names current in /data are affected by the consecutive capital letters in digraphs issue, but it may come up in future. I found some articles which are better examples than the town linked earlier: IJsbrand Chardon, Sylvana IJsselmuiden, Nikki IJzerman. None of these people are politicians, but they at least show that there are notable people with Wikipedia articles who have 'IJ' in their first or last names. I'm unsure if it affects names from other languages/cultures as well. I had thought some languages which treat digraphs as single letters also capitalise both letters, but it seems not. This issue may also be relevant to names bearing acronyms as some articles don't follow the convention of including full stops after initials, for example: Abdoe'lxarim MS, Fariz RM, Addie MS, Patta PT Joest, Seshu KMR Ponnapalli. (Most names with initials include full stops. I'm unsure if Wikipedia has guidelines around including full stops after initials in names in article titles. Maybe it's within the scope of acceptable engvar variation?) – Scyrme (talk/solidarity) 20:03, 24 July 2026 (UTC)
- The only oddball seems to be Carl XVI Gustaf; all other names with a regnal number end with the regnal number. Victoria, Crown Princess of Sweden, the heir apparent, and Princess Estelle, Duchess of Östergötland, second in line, have unique names so (I think) that if they use regnal numbers, the number will fall at the end like Margaret I of Denmark. So, until we have to actually worry about it, we can assume that regnal numbers are roman numerals in the set
[XVI]which should be sufficient to the 39th monarch of the name. When the last characters in the name are a<space>followed by characters from the regnal number set, the module will replace the<space>with . Editors of Carl XVI Gustaf's article have not inserted in his name so the module will not.{{Current leader/sandbox|Monaco|sovereign prince|link=no}}→ Albert IIAlbert II<span style="display:none" data-plural="0"></span>
{{Current leader/sandbox|Monaco|sovereign prince}}→ Albert II[[Albert II, Prince of Monaco|Albert II]]<span style="display:none" data-plural="0"></span>
{{Current leader/sandbox|vatican|pope|link=no}}→ Pope Leo XIVPope Leo XIV<span style="display:none" data-plural="0"></span>
{{Current leader/sandbox|vatican|pope}}→ Pope Leo XIV[[Pope Leo XIV]]<span style="display:none" data-plural="0"></span>
{{Current leader/sandbox|vatican|pope|format=short}}→ Leo XIV[[Pope Leo XIV|Leo XIV]]<span style="display:none" data-plural="0"></span>
{{Current leader/sandbox|swe|king}}→ Carl XVI Gustaf[[Carl XVI Gustaf]]<span style="display:none" data-plural="0"></span>
- —Trappist the monk (talk) 14:24, 25 July 2026 (UTC)
- Thanks! I didn't know non-breaking spaces could be inserted into links, like
[[Pope Leo XIV]]without breaking them. Good to know. {{Incumbent pope}} only includes one in the displayed text after the pipe, so I assumed it was necessary/preferable to do so. – Scyrme (talk/solidarity) 14:58, 25 July 2026 (UTC)
- Thanks! I didn't know non-breaking spaces could be inserted into links, like
- The only oddball seems to be Carl XVI Gustaf; all other names with a regnal number end with the regnal number. Victoria, Crown Princess of Sweden, the heir apparent, and Princess Estelle, Duchess of Östergötland, second in line, have unique names so (I think) that if they use regnal numbers, the number will fall at the end like Margaret I of Denmark. So, until we have to actually worry about it, we can assume that regnal numbers are roman numerals in the set
Italics
[edit]@Trappist the monk: {{Heads of state of republics}} uses italics to indicate heads of state of non-UN members. Wrapping {{Current leader}} with double apostrophes seems to work for this purpose, ie. ''{{Current leader|XK|head of state}}'' → Albulena Haxhiu, but would it be better to have a parameter like |italics=yes handled by {{Current leader}}? Or is just using the double apostrophes good enough? – Scyrme (talk/solidarity) 23:18, 24 July 2026 (UTC)
- I guess I don't see the need. If the editors of some article or template that uses this template want the rendering to be bold or italicized or whatever, they can apply the appropriate markup externally as
{{heads of state of republics}}does. I can't think of any advantage that|italics=yeshas over the use of italic wikimarkup. - —Trappist the monk (talk) 14:36, 25 July 2026 (UTC)
- Template-Class biography pages
- Template-Class biography (politics and government) pages
- NA-importance biography (politics and government) pages
- Politics and government work group articles
- Template-Class International relations pages
- NA-importance International relations pages
- WikiProject International relations articles
- Template-Class politics pages
- NA-importance politics pages
- WikiProject Politics articles
