Manual talk:$wgNamespaceAliases

From mediawiki.org
Latest comment: 14 years ago by Capmo in topic Re: Override

Re: Override[edit]

Override default namespace names.

I think that, if "default namespace names" are overridden by some other names, the defaults may be disabled. Does it really happen? Mulukhiyya 09:20, 2 March 2008 (UTC)Reply

I have no idea if these replace or are additional names for namespaces. "Alias" does suggest additional, but who knows if the name is accurate. As I noticed in my edit summary I just copied the initial notes from Tim's initial documentation. So best ask someone to experiment and report back, or ask Tim. pfctdayelise 07:27, 13 March 2008 (UTC)Reply
(Ah, thank you!) So, the sentence above was written by someone else? (Tim?) Anyway, I'll ask other people. Mulukhiyya 12:11, 13 March 2008 (UTC)Reply

I personally haven't experimented for this yet, but Schu said s/he did it. According to Schu, $wgNamespaceAliases works just like the following example:

There seems that "WP:" is just an additional alternate name for the primary name, "Wikipedia:", and does not replace the primary name. So I think "override" is not fit for this case. Mulukhiyya 12:33, 13 March 2008 (UTC)Reply

I have used this, and it gives an alternate way of getting to the same namespace. For me, when you arrive at the page, the namspace appears in the url and in the title of the page as what the original namespace is.
On a related note, this is not enough replacement for me, I would like the "alias" name to replace the default name in the url, and have been trying without success to use Apache's rewrite rules to do that. Smaug 00:56, 25 March 2008 (UTC)Reply
Smaug, in order to have the alias replace or "override" the original name, you may want to try the suggestion given right below, in section "How to rename namespace Image to File". I used it for the Image namespace, but I guess it can be done for any namespace. —Capmo 16:19, 1 May 2009 (UTC)Reply
Thank you for clarification (and sorry for late reply). Someone rewrote the description, and now there's no further problem, I think :) Mulukhiyya 08:34, 22 August 2008 (UTC)Reply

Where do you put that line ?[edit]

I mean $wgNamespaceAliases = array(

       'Wikipedian' => NS_USER,
       'Help' => 100,);

Where is that supposed to go ? I could not use it in LocalSettings.php... So where ?

—The preceding unsigned comment was added by NewMorning (talkcontribs) 2008-06-22T17:12:28. Please sign your posts with ~~~~!

obviously, don't work[edit]

:((

—The preceding unsigned comment was added by 90.59.210.221 (talkcontribs) 2008-07-23T12:15:17. Please sign your posts with ~~~~!

How to rename namespace Image to File[edit]

1. Atribute new names to namespaces Image & Image_talk:

$wgExtraNamespaces[NS_IMAGE]      = "File";
$wgExtraNamespaces[NS_IMAGE_TALK] = "File_talk";

2. Create aliases to the old names:

$wgNamespaceAliases['Image']      = NS_IMAGE;
$wgNamespaceAliases['Image_talk'] = NS_IMAGE_TALK;

I don't know if there's a simpler way to do this, but it worked for me! Capmo 16:13, 1 May 2009 (UTC)Reply

Does this still exist?[edit]

Last comment here was four years ago... I'm wondering because I want to offer some shortcut NS aliases on my wiki. This documentation is poor, and it would be great if a snippet of Wikipedia's actual $wgNamespaceAliases was added to make it more clear how it works. I'm assuming that the following line should work to offer shortcuts similar to W:WP:SC?

$wgNamespaceAliases = array(
        'U' => NS_USER,
        'UT' => NS_USER_TALK,
        'P' => NS_PROJECT,
        'PT' => NS_PROJECT_TALK,
        'F' => NS_FILE,
        'I' => NS_FILE,
        'FT' => NS_FILE_TALK,
        'IT' => NS_FILE_TALK,
        'MW' => NS_MEDIAWIKI
        'MWT' => NS_MEDIAWIKI_TALK,
        'T' => NS_TEMPLATE,
        'TT' => NS_TEMPLATE_TALK,
        'H' => NS_HELP,
        'HT' => NS_HELP_TALK,
        'C' => NS_CATEGORY,
        'CT' => NS_CATEGORY_TALK
    );