Page MenuHomePhabricator

indicate canonical alias on meta=siteinfo&siprop=magicwords|specialpagealiases
Closed, ResolvedPublic

Description

It is possible to get information about the canonical alias of magicwords/specialpage with the api? It is nice to get the alias of an magicword/specialpage which work on all wikis.

Maybe add a canonical="" to the the alias-tag

Indicate the localname is also nice, but it looks that the localname is always the first entry of that list.

Thanks.


Version: 1.18.x
Severity: enhancement

Details

Reference
bz28671

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:37 PM
bzimport set Reference to bz28671.
bzimport added a subscriber: Unknown Object (MLST).

For the specialpages, surely realname is the canonical one?

<specialpage realname="Allmessages">
  <aliases>
    <alias>MediaWiki-Systemnachrichten</alias>
    <alias>AllMessages</alias>
  </aliases>
</specialpage>

Same for name on magicword?

<magicword name="ucfirst">
  <aliases>
    <alias>INITIAL_GROSS:</alias>
    <alias>UCFIRST:</alias>
  </aliases>
</magicword>

(In reply to comment #1)

For the specialpages, surely realname is the canonical one?

<specialpage realname="Allmessages">
  <aliases>
    <alias>MediaWiki-Systemnachrichten</alias>
    <alias>AllMessages</alias>
  </aliases>
</specialpage>

No, that does not work for Randompage

Same for name on magicword?

<magicword name="ucfirst">
  <aliases>
    <alias>INITIAL_GROSS:</alias>
    <alias>UCFIRST:</alias>
  </aliases>
</magicword>

That does not work for redirect or img_alt

<specialpage realname="Randompage">
  <aliases>
    <alias>Zufällige_Seite</alias>
    <alias>Random</alias>
    <alias>RandomPage</alias>
  </aliases>

Why not...?

(In reply to comment #3)

<specialpage realname="Randompage">
  <aliases>
    <alias>Zufällige_Seite</alias>
    <alias>Random</alias>
    <alias>RandomPage</alias>
  </aliases>

Why not...?

Because the canonical one is <alias>Random</alias> not <alias>RandomPage</alias>, it should work with RandomPage, but it only an english alias.

Magic words:

  • Note to translators:
  • Please include the English words as synonyms. This allows people
  • from other wikis to contribute more easily.

Special pages
Aliases from the fallback

  • localisation (usually English) will be included by default.

The magic word ones aren't guaranteed... And the english would only be there as fallback, unless it's added..

Gonna log a couple of dependency bugs for this.. It's a bit of a farce

Bryan.TongMinh wrote:

(In reply to comment #5)

Magic words:

  • Note to translators:
  • Please include the English words as synonyms. This allows people
  • from other wikis to contribute more easily.

Didn't we discuss this elsewhere and resolved to unconditionally add the English canonical word?

(In reply to comment #6)

(In reply to comment #5)

Magic words:

  • Note to translators:
  • Please include the English words as synonyms. This allows people
  • from other wikis to contribute more easily.

Didn't we discuss this elsewhere and resolved to unconditionally add the
English canonical word?

If that's the case, it means half of this original bug is invalid then...

(In reply to comment #6)

Didn't we discuss this elsewhere and resolved to unconditionally add the
English canonical word?

That makes a lot of sense. Use this bug or one of the others that Reedy filed for tracking progress on it?

(In reply to comment #6)

(In reply to comment #5)
Magic words:

  • Note to translators:

Please include the English words as synonyms. This allows people

from other wikis to contribute more easily.

Didn't we discuss this

elsewhere and resolved to unconditionally add the

English canonical word?

This was already done with r81960

This bug was about adding a indicator in the api result to see the canonical form which will work in all wikis. This can also be done by adding a language attribute about the language, where the alias came from, than the alias from "en" can be used as canonical form.

Or the bug gets closed, because the realname can be used, but I have not tested, if that works for all special pages.

On the one hand, it looks like there *isn't* a "canonical" name. "realname" isn't guaranteed to work at all.

But if every language falls back to 'en', then the aliases defined for 'en' are all "canonical". And all the 'en' alias lists seem to include the "realname".

(In reply to Brad Jorsch from comment #10)

On the one hand, it looks like there *isn't* a "canonical" name. "realname"
isn't guaranteed to work at all.

But if every language falls back to 'en', then the aliases defined for 'en'
are all "canonical". And all the 'en' alias lists seem to include the
"realname".

In OutputPage, we use the following:

list( $canonicalSpecialPageName, /*...*/ ) =

SpecialPageFactory::resolveAlias( $title->getDBkey() );

to populate $wgCanonicalSpecialPageName in js, which is probably what's being asked for.

(In reply to Bawolff (Brian Wolff) from comment #11)

In OutputPage, we use the following:

list( $canonicalSpecialPageName, /*...*/ ) =

SpecialPageFactory::resolveAlias(

$title->getDBkey() );

to populate $wgCanonicalSpecialPageName in js, which is probably what's
being asked for.

SpecialPageFactory::resolveAlias returns the "realname" value.

But there's nothing forcing that realname to actually work as [[Special:Realname]], it just relies on the realname being listed in the 'en' version of $specialPageAliases and every other language falling back to 'en' eventually.

Anomie claimed this task.

Magic words were fixed in r81960, and special pages were adjusted to force the realname as an alias in Gerrit change 161499, which means this is resolved now.