145.738
измена
м (Превођење именских простора и/или магичних речи) |
Нема описа измене |
||
{{превод}}
{{H:h|editor toc}}
Page titles in MediaWiki are composed of two parts: an optional namespace name, and the remainder of the title. For example, this page has the title <
By default, a wiki using the [[w:MediaWiki|MediaWiki]] software has 18 '''namespaces''', including:
* the main namespace, where page names have no prefix
* 15 additional namespaces, each with its own prefix. (Two namespaces, the so-called 'project' namespaces, get their names from the name of the wiki project, and so differ in name from one wiki to the next; on the Wikipedia, they are called '''Wikipedia:''' and '''Wikipedia talk:'''. On each wiki, these project namespaces (whatever they may happen to be for that wiki), can be
* two
In addition to these 18 namespaces, the Wikipedia specially adds to these the '''Portal:''' and '''Portal talk:''' namespaces. Other wiki projects may have their own additional custom namespaces.
Namespaces allow, among other things, a separation of content from policy and discussion. They encourage separation of the pages of a wiki into a core set intended for public viewing, and private information intended for the editing community.
* the image namespace (with the full-size images)
* the category namespace (for navigation)
* the [[help:help|help]] pages and the preferences page (as far as they concern viewing)
By default, searches and the [[Special:Randompage|random page feature]] are restricted to the main namespace, thus the user interface is directed towards readers who are not part of the community. Note that this separation of community and readership is not a feature of many wiki engines. It may not be required for your editing community. You are always free to put discussion and policy in the main namespace, if you desire.
*[[Special:Allpages]] can be applied to a namespace of choice
From [[m:MediaWiki 1.5|MediaWiki 1.5]] [[Help:Recent changes|Recent changes]] ditto
*[[Help:Searching|Searching]] can be restricted to any subset of namespaces
[[Help:User contributions|User contributions]] can
It is possible to customize the visual appearance of pages and the appearance and function of templates based on namespace. See sections [[#Template programming|Template programming]] and [[#CSS based namespace detection|CSS based namespace detection]] below.
== List of namespaces ==
The two virtual namespaces, main namespace and 15 auxiliary namespaces in ''this'' project (Meta) are as follows (the [[help:Variable|variable]]s for them are also shown).
Note that the number of pages in each namespace may not be displayed on all MediaWiki projects, because this counting feature may be [[mw:Manual:$wgAllowSlowParserFunctions|disabled]]: on this Wiki, per-namespace page counting is currently {{#ifeq:{{urlencode:{{PAGESINNS:0}}}}|{{urlencode:[[:{{ns:Template}}:PAGESINNS:0]]}}|disabled|available}}.
{|class="wikitable" style="clear:both"
|-
!Variables
!Alternate syntax
!Name, linked to list of all such pages
!Nr. of pages<br />(see note above)
!Notes
|-
|<nowiki>{{ns:-2}}</nowiki>
|<nowiki>{{ns:
|"{{ns:-2}}"
|
|
|-
|<nowiki>{{ns:-1}}</nowiki>
|<nowiki>{{ns:
|"{{ns:-1}}"
|
|
|-
|<nowiki>{{ns:
|
|[{{
|{{#ifeq:{{PAGESINNS:0}}|[[:{{ns:Template}}:PAGESINNS:0]]|''disabled''|{{PAGESINNS:0}}}}
|main namespace, no prefix, or optionally a colon (this is needed when using the page as template)
|-
|<nowiki>{{ns:1}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:1}}|[[:{{ns:Template}}:PAGESINNS:1]]|''disabled''|{{PAGESINNS:1}}}}
|see [[:Help:Talk page]] for this and the following odd-numbered namespaces
|-
|<nowiki>{{ns:2}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:2}}|[[:{{ns:Template}}:PAGESINNS:2]]|''disabled''|{{PAGESINNS:2}}}}
|
|-
|<nowiki>{{ns:3}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:3}}|[[:{{ns:Template}}:PAGESINNS:3]]|''disabled''|{{PAGESINNS:3}}}}
|
|-
|<nowiki>{{ns:4}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:4}}|[[:{{ns:Template}}:PAGESINNS:4]]|''disabled''|{{PAGESINNS:4}}}}
|the project namespace for matters ''about'' the project, such as guidelines and discussions; see also the [[Help:|Help:]] namespace
|-
|<nowiki>{{ns:5}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:5}}|[[:{{ns:Template}}:PAGESINNS:5]]|''disabled''|{{PAGESINNS:5}}}}
|
|-
|<nowiki>{{ns:6}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:6}}|[[:{{ns:Template}}:PAGESINNS:6]]|''disabled''|{{PAGESINNS:6}}}}
|[[help:images and other uploaded files|images and other uploaded files]], with [[
|-
|<nowiki>{{ns:7}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:7}}|[[:{{ns:Template}}:PAGESINNS:7]]|''disabled''|{{PAGESINNS:7}}}}
|
|-
|<nowiki>{{ns:8}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:8}}|[[:{{ns:Template}}:PAGESINNS:8]]|''disabled''|{{PAGESINNS:8}}}}
|system messages (list: [[Special:
|-
|<nowiki>{{ns:9}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:9}}|[[:{{ns:Template}}:PAGESINNS:9]]|''disabled''|{{PAGESINNS:9}}}}
|
|-
|<nowiki>{{ns:10}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:10}}|[[:{{ns:Template}}:PAGESINNS:10]]|''disabled''|{{PAGESINNS:10}}}}
|the default namespace for [[help:template|template]]s: the wikitext code <nowiki>{{</nowiki>''name'' }} refers to and includes the page Template:''name''
|-
|<nowiki>{{ns:11}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:11}}|[[:{{ns:Template}}:PAGESINNS:11]]|''disabled''|{{PAGESINNS:11}}}}
|
|-
|<nowiki>{{ns:12}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:12}}|[[:{{ns:Template}}:PAGESINNS:12]]|''disabled''|{{PAGESINNS:12}}}}
|typically used for the MediaWiki User's Guide, with the wikitext a frequently refreshed copy of the master version on Meta-Wikipedia, but with project-specific templates
|-
|<nowiki>{{ns:13}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:13}}|[[:{{ns:Template}}:PAGESINNS:13]]|''disabled''|{{PAGESINNS:13}}}}
|
|-
|<nowiki>{{ns:14}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:14}}|[[:{{ns:Template}}:PAGESINNS:14]]|''disabled''|{{PAGESINNS:14}}}}
|each page (list: [[Special:Categories]]) represents a [[Help:Category|category]] of pages, with each category page displaying a list of pages in that category and optional additional text.
|-
|<nowiki>{{ns:15}}</nowiki>
|<nowiki>{{ns:
|[{{
|{{#ifeq:{{PAGESINNS:15}}|[[:{{ns:Template}}:PAGESINNS:15]]|''disabled''|{{PAGESINNS:15}}}}
|
|}
Note that all characters of namespace prefixes are case-insensitive, so one can write,
These names are set in the MessagesXX.php language files. The English defaults are below:
<source lang="php">
$namespaceNames = array(
NS_MEDIA => 'Media',
NS_SPECIAL => 'Special',
NS_MAIN => '',
NS_TALK => 'Talk',
NS_USER => 'User',
NS_USER_TALK => 'User_talk',
# NS_PROJECT set by $wgMetaNamespace
NS_PROJECT_TALK => '$1_talk',
NS_FILE => 'File',
NS_FILE_TALK => 'File_talk',
NS_MEDIAWIKI => 'MediaWiki',
NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
NS_TEMPLATE => 'Template',
NS_TEMPLATE_TALK => 'Template_talk',
NS_HELP => 'Help',
NS_HELP_TALK => 'Help_talk',
NS_CATEGORY => 'Category',
NS_CATEGORY_TALK => 'Category_talk',
);</source>
==Generic namespace names==
On the column "Alternate syntax" in the table at the beginning of the previous section, a list of project-independent namespace names (also called generic namespace names) is shown in the form of <nowiki>{{ns:</nowiki>''namespace name''<nowiki>}}</nowiki>, the same as those on Meta and the English Wikipedia, except that "Meta" and "Wikipedia" are replaced by "Project". The prefixes are the terms listed, followed by a colon. Like any namespace name, a project-independent namespace name is case-insensitive.
The prefix "Project:" is for every project automatically converted to the project namespace, e.g. try the link [[Project:xyz]]. It is like a [[Help:Piped link|piped link]]. Therefore a [[Help:Page name|page name]] starting with "Project:" is not possible (unless, of course, that is the name of the project).
An exception to the rule that the link label is the name used in the wikitext and not the converted name, applies if the target of a redirect is expressed using a project-independent namespace name: in that case the converted name is shown on the redirect page, compare [http://meta.wikimedia.org/w/index.php?title=Babel&redirect=no] with the preview of [http://meta.wikimedia.org/w/index.php?title=Babel&action=edit].
==Other namespace aliases==
On some wikis there are also other namespace aliases (again case-insensitive):
*on the English Wikipedia:
**wp for Wikipedia, try e.g. [[w:wp:a]]
**wt for Wikipedia talk, try e.g. [[w:wt:a]]
A namespace alias cannot be equal to an interwiki prefix. For example, a wiki community cannot decide to set "tt" as alias for "Template talk" as long as it wants to keep its use as interwiki prefix for the corresponding Tatar wiki, try [[tt:a]].
See also [[mw:Manual:$wgNamespaceAliases]].
==Prefixes in various languages==
For [[w:Wikimedia|Wikimedia]] projects this project prefix is "Wikipedia:", "Wiktionary:", "Wikibooks:", "Wikisource:", "Wikiquote:"
To check which prefix is used in a project, you may edit and preview a page in the project to render the variable <nowiki>{{ns:Project}}</nowiki> (and cancel the edit after the check), though what you will see is deprived of a colon. Another way: visiting any project page there, you will find it at the left (in LTR languages) or the right (in RTL languages) of the page title. This applies even for non-existing pages, so, in view of the conversion explained in the previous section, you can use a URL like http://ar.wikipedia.org/wiki/Project:A. Also you may go to a project page of a target language from a project page of a language familiar to you (e.g. [[en:Wikipedia:Contact us]]) by clicking an interlanguage link, if applicable. "Talk", "User", "Image" and combinations can also be translated in the case of non-English wikis
==Colon in page name==
Adding a colon to a page name does not automatically create a new namespace. To see the namespace of a page, use <nowiki>{{
To take some examples from '''Wiktionary''': [[m:wikt:Wiktionary:FAQ|Wiktionary:FAQ]] has Talk page [[m:wikt:Wiktionary talk:FAQ|Wiktionary talk:FAQ]], but [[m:wikt:Wiktionary Appendix:Colours|Wiktionary Appendix:Colours]] has Talk page [[m:wikt:Talk:Wiktionary Appendix:Colours|Talk:Wiktionary Appendix:Colours]], because the first is in the project preface namespace and the second is not. In [[m:wikt:Special:Allpages|Special:Allpages]], accordingly, the first is, unlike the second, not in the list of articles, but in the page list of the namespace Wiktionary.
''For instructions on '''creating a custom namespace''' or for more information, see [[Help:Custom namespaces]].''
A project can have additional namespaces. For example, if a single project is multilingual (as opposed to the case of sister projects, each in one language) there may be a namespace [[Help:Help|Help]] and also a namespace Hilfe:, for help pages in the English and German language, respectively.
A list of all namespaces is in the dropdown menus of [[Special:Prefixindex]], [[Special:Allpages]], [[Special:Recentchanges]], and "My contributions". With [[m:query|the Query extension]] a list including also the numbers of the namespaces is given by <nowiki>{{SERVER}}{{SCRIPTPATH}}</nowiki>/api.php?action=query&meta=siteinfo&siprop=namespaces , for this project {{SERVER}}{{SCRIPTPATH}}/api.php?action=query&meta=siteinfo&siprop=namespaces .
Custom namespaces are numbered from 100{{#if: {{ns:100}} |, on this project starting with {{ns:100}}, 101 = {{ns:101}}}}. See [[m:Help:MediaWiki help policy]] for a list of custom namespaces on Meta.
== Template programming ==
Templates can automatically detect namespaces and thus change how they look or what they do, depending on what type of page they are used on. They can do this by using [[Help:Magic words|magic words]] such as <code><nowiki>{{NAMESPACE}}</nowiki></code> and [[m:Help:ParserFunctions|parser functions]] such as <code><nowiki>{{#ifeq:}}</nowiki></code>.
The English Wikipedia has several meta-templates that make it easy to detect namespaces. Then you don't have to handle magic words and parser functions in your own template code. Or you can use them as code examples to learn how to do it. Here are two of them:
* <nowiki>{{</nowiki>{{mlw|Template:Main other||main other}}}} – A very easy to use one. There are several variants of this one for different needs.
* <nowiki>{{</nowiki>{{mlw|Template:Namespace detect||namespace detect}}}} – The very versatile one.
If you copy these templates to another language Wikipedia or other Wikimedia project, then read the section "{{mlw|Template:Main talk other|Copying to other projects?|Copying to other projects?}}" in their documentation.
== CSS based namespace detection ==
When MediaWiki renders a page it adds some CSS classes in the HTML body tag to indicate the namespace of the page. This can be used in CSS code to detect namespace. For instance for this page the body tag looks like this:
<source lang="html">
<body class="mediawiki ltr ns-12 ns-subject page-Help_Namespace skin-monobook">
</source>
The "ns-12" class indicates that this is a "Help:" page. And the "ns-subject" class indicates that this is a subject page, that is not a talk page and not a "Special:" page.
{|class="wikitable" style="clear:both"
|-
! Class
! Description
|-
| ns--1, ns-special
| All "Special:" pages, see [[Special:SpecialPages]]. Note the double dashes in "ns--1".
|-
| ns-0 - ns-999
| Each of the namespaces, such as ns-0 (main), ns-1 (Talk) and so on.
|-
| ns-subject
| Pages in all subject namespaces, that is all even namespaces. Such as ns-0 (main), ns-2 (User) and so on. Not talk pages and not "Special:" pages.
|-
| ns-talk
| All talk pages, that is all uneven namespaces. Such as ns-1 (Talk), ns-3 (User talk) and so on.
|}
This can be used in CSS code to detect namespace and change looks of something or even hide it based on what type of page the object is shown on. For instance like this:
<source lang="css">
.ns-subject .somebox { /* Green border when on subject pages. */
border: 1px solid #00FF00;
}
.ns-talk .somebox { /* Blue border when on talk pages. */
border: 1px solid #0000FF;
}
</source>
The English Wikipedia uses this to change the colour of the pages based on namespace. See the lines with ".ns-0" in {{mlw|MediaWiki:Monobook.css}}.
== See also ==
*[[Namespace]] (list of custom namespaces)
*[[Help:
*[[Help:
*[[Help:Template|Help:Template]]
*[[
*[[Transwiki|Transwiki]], a cross-project pseudo-namespace
*[[Template:Wikivar|Template:Wikivar]]
*[[MW:Manual:Using custom namespaces|Manual:Using custom namespaces]]
{{h:f|enname=Namespace}}
|