Page MenuHomePhabricator

create #speciale parser function
Closed, ResolvedPublic

Description

Please create a parser function, that give the localized encoded special pagename (#special -> #speciale). There is already a parser function for namespace (ns -> nse).

This is relevant for use in the param list of fullurl, like 'Centralauth-merge-notlogged'.

Thanks.


Version: unspecified
Severity: enhancement

Details

Reference
bz23006

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:05 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz23006.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 7765
add speciale parser function

The attachment add a speciale parser function, to get the urlencode name of a special page.

Attached:

Whats wrong with {{urlencode:{{#special:Foo}}}}. I understand the rationale behind really common variables like {{PAGENAME}} having {{PAGENAMEE}} equivelents, but for something like {{#special:}} thats barely ever used in itself, whats the point (read usecase)?

You are right, but urlencode replace spaces by + and that does not look like other pagenames. Yes, it works, but it is not the best, I think, because there is also a nse parser function.

Using urlencode also make the wikitext more complex, for example when using fullurl and the special pagename is part of the query.

How about {{urlencode:.|WIKI}}. Btw that should be documented in http://www.mediawiki.org/wiki/Help:Magic_words

(In reply to comment #4)

How about {{urlencode:.|WIKI}}. Btw that should be documented in
http://www.mediawiki.org/wiki/Help:Magic_words

No problem with that, but we have for many function an encoding opposite:

pagename -> pagenamee
namespace -> namespacee
fullurl -> fullurle
localurl -> localurle
ns -> nse
special -> ???

Perhaps add a {{rawurlencode:}} (to equivalant the PHP version) that will enable this (space to _ or %20 instead of +) for not just this but also for other things. See also:
http://meta.wikimedia.org/wiki/Talk:Interwiki_map#google

(In reply to comment #6)

Perhaps add a {{rawurlencode:}} (to equivalant the PHP version) that will

And that's {{urlencode:.|PATH}}

Patch looks fine, but I'm not convinced that we actually need this shortcut.

sumanah wrote:

Umherirrender, can you talk more about the use case for this? Thanks.

'Centralauth-merge-notlogged' has changed, so there is no need for this parser function in that message, but there can be use case where a #speciale parser function makes the template programming code easy on wiki. I have no pratical use case at the moment, but when the function exist, it will be used, I am sure.

Merged. Please make sure to update only documentation at www.mediawiki.org.

How does this work with Italian and Albanian translations "#speciale" of old magic word "#special"?

EN.WP.ST47 wrote:

They need to have the desired name of this function translated in their MessagesXx.php, as you can see was done with 'speciale' in the patch, attached to this bug, for MessagesEn.php.

You have to add new aliases to the software. You can do it on translatewiki.net

[[translatewiki:Special:AdvancedTranslate]], choose your language and "Magic words".

Looking at that page shows your problem for 'it'. The word "speciale" is already given to "special" as alias. I have no idea, to handle that case.

For sake of portability there should be no translation value conflicting with a canonical value. Otherwise "#speciale" might mean #special on an "it" content-language wiki and #speciale on an any other content-language wiki.

Revert?

Canonical form wins over the aliases. So there is no problem with portability. The problem is, that existing use of #speciale (as it alias) will now act like #speciale (as canonical form). This can break thinks or not.

Maybe ask a i18n people? Feel free to revert, if you think, that a revert is the best.

Umherirrender claimed this task.