Manual:Interwiki

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Interwiki and the translation is 39% complete.

Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎polski • ‎português • ‎română • ‎suomi • ‎русский • ‎العربية • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어

Hiperligações Interwiki são hiperligações para páginas de outros projetos, utilizando um estilo de hiperligação interno prefixo.

Interwiki links make it possible to link to pages of (e.g.) Wikipedia, Wikibooks, Wikinews etc. or to your wiki-project in different languages. (See Manual:Família Wiki .)

A link like [[Wikipedia:Main Page]] will appear like this: Wikipedia:Main Page and redirect you to Wikipedia's Main Page.

Hiperligações Interwiki para outros projetos

As hiperligações Interwiki estão alojadas na tabela interwiki da base de dados do MediaWiki. A lista está disponível a partir da propriedade interwikimap da API de consulta de metadados siteinfo , em outras palavras api.php?action=query&meta=siteinfo&siprop=interwikimap

Aviso Aviso: The api interwikimap property gives incorrect results on wikis using the interwiki cache (like Wikimedia Wikis) prior to MediaWiki 1.19 (Bug 19838)

Predefinição

Vários projetos do Wikimedia (e outros) estão prontos para a associação com a interwiki, por predefinição, e assim, pod utilizá-los sem editar a sua base de dados.

O seguinte, são alguns exemplos de prefixos da interwiki que estão disponíveis por predefinição (Wikipédia também está disponível, 1.10 e superior):

prefixo URL de destino exemplo de utilização
commons https://commons.wikimedia.org/wiki/ [[commons:MediaWiki]]
mediazilla http://bugzilla.wikimedia.org/ [[mediazilla:1209]]
meta https://meta.wikimedia.org/wiki/ [[meta:Main Page]]

A lista completa das listas predefinidas da interwiki está disponível em maintenance/interwiki.list

Consulte m:Ajuda:Associar com Interwiki para informação completa em como associar de/para os projetos do Wikimedia.

Em algumas instalações, nenhum destes está pré-instalado. Neste caso, tente [[metawikipedia:Main Page|metawikipedia:Página Principal]].


Adicionar um novo site da Web para a associação com a interwiki

  • As hiperligação Interwiki são definidas na tabela da base de dados da interwiki.
  • Para modificar estas, irá precisar de editar a base de dados, como abaixo.
  • You might prefer to install an Interwiki extension, which eases the process.

[1]

As Wikipedia isn't set up by default prior to version 1.10, you might want to add it (and other projects that you desire).

The examples below show how to set up w: as a link to the English Wikipedia.

The idea is to insert a line of the form:

('prefix', 'URL format string', 1, 0)

into the interwiki table.

Uma linha

Os utilizadores avançados podem utilizar uma única linha de comando, como se segue:

  • MySQL e PostgreSQL
MediaWiki versions: 1.10 – 1.16
INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans) VALUES ('w', 'https://en.wikipedia.org/wiki/$1', 1, 0);

As versões mais recentes do MediaWiki requerem alguns campos extra, tal como iw_wikiid.

Exportar, adicionar, reimportar

Alternatively, you can use the following multi-step process, which exports the interwiki table, adds a line, then re-imports it:

  • Exportar a tabela da base de dados da interwiki
  • add to the end of the table a line of the following form (using English wikipedia as an example):
('w', 'https://en.wikipedia.org/wiki/$1', 1, 0);
In the above code, the semicolon ';' as seen, MUST be at the end of the table. At the end of any other line within that table Only has ','.
  • Import the database table interwiki

Para testar

Para testar a configuração:

  • Ir para o seu site,
  • criar um artigo, com o seguinte conteúdo:
    [[w:Wikipedia:Village pump|]]
  • This should display a link to the 'Village pump' page on en.Wikipedia.org (the url https://en.wikipedia.org/wiki/Wikipedia:Village_pump)

Documentação de ajuda

In detail, the fields of the interwiki database table are as follows:

  • iw_prefix: choose a prefix, which is used for interwiki linking, e.g. "wikipedia" for linking to Wikipedia.
    Prefixes must be all lower-case.
  • iw_url: enter the project's URL, e.g. https://en.wikipedia.org/wiki/$1 for Wikipedia. Don't forget the $1 as it is replaced with the article's name you are linking to ([[Wikipedia:Main Page]] links to https://en.wikipedia.org/wiki/Main_Page).
    If iw_url is a binary BLOB field (SVN version, but also occurs in version 1.11.0, bug?) this won't work directly. You have to enter it as binary. There are two possible solutions: 1. You save the url in a plain text file, then import it through phpmyadmin. 2. You can directly enter an SQL query.
  • iw_local: if 1, your wiki will redirect even external links of the form iw_prefix:title, not only those from its own pages; you need this if you want to use the redirect functionality from outside your wiki or other wikis use your transwiki functions for nested transwiki links (like w:en:fr:Wikipédia:Accueil). Consulte m:Help:Interwiki linking#Interwikis não locais.
  • iw_trans: "transwiki transclusion" - set to 1 if you want to use pages from the other wiki as templates. You will also need to set $wgEnableScaryTranscluding = true in your LocalSettings.php. Requires a protocol to be specified in iw_url.
  • iw_api: URL to the MediaWiki API, e.g. https://en.wikipedia.org/w/api.php (optional).
  • iw_wikiid: Database name of the wiki (If locally accessible). May be used (later?) for interwiki transclusions. (optional)

Tools.svg Dica para administradores: Several help pages link to MediaWiki.org's Manual namespace. To make these links work on your local wiki, add an interwiki link with iw_prefix=manual and iw_url=http://www.mediawiki.org/wiki/Manual:$1

Tools.svg Dica para administradores: $wgTranscludeCacheExpiry in your LocalSettings.php should be set if changes in the transcluded wiki are done. Alternatively, you can flush the table transcache on your local wiki.


Referências

  1. Is using Extension:Interwiki , make sure to use version 2.1, which fixes a caching latency problem

Hiperligações Interwiki para outros idiomas

Hiperligações Interwiki para outros idiomas

If you have installed a Wiki family , you can link from an article in English to an article in German (if you have a German project, too). You can set up MediaWiki, to show those links in the sidebar, just below the toolbox.

In your filesystem, there is a subfolder of your MediaWiki installation, called "languages". Go there and have a look at "Names.php " as it contains a list of known languages and their prefixes. E.g. you want to add your German project, search "Names.php" for "Deutsch" and note the prefix "de".

If you know the "right" prefix, edit your database by adding a new line to table interwiki:

  • iw_prefix: language-prefix (e.g. "de" for German), which is listed in "Names.php"
  • iw_url: URL to your wiki-project (e.g. http://de.example.org/index.php/$1)
  • iw_local: same as above "Adding More"
  • iw_trans: same as above "Adding More"

Now, you can link an article to the same in other languages. Adding [[de:Hauptseite]] on your English Main_Page will create a link "Deutsch" below the toolbox, which leads to the Main_Page of the German wiki (Hauptseite).

Note, that this link is shown in Sidebar's section, only, and not inside of the article. If you want to create a link inside of the text, you have to add a colon previous to the prefix: [[:de:Hauptseite]] or set $wgInterwikiMagic to false.

Exportar a tabela da interwiki a partir da wiki

The interwiki table can be queried through the API:Meta module using meta=siteinfo&siprop=interwikimap.

The following JavaScript code can be used to generate the SQL INSERT statements to fill the interwiki table, when run inside the wiki where that info should be extracted, for example, injecting the code through the browser's developer tools or placing it inside Special:MyPage/<skinname>.js and previewing:

function ExtractInterwikiMapTable() {
	$.getJSON(mw.config.get('wgScriptPath') + '/api.php?action=query&meta=siteinfo&siprop=interwikimap&format=json', function(data) {
		var iw_prefix, iw_url, iw_local, iw_api, re_escape = /(')/g, result = '';
		for (var i = 0, iwm = data.query.interwikimap; i < iwm.length; i++) {
			iw_prefix = "'" + iwm[i].prefix.replace(re_escape, '\\$1') + "'";
			iw_url = "'" + iwm[i].url.replace(re_escape, '\\$1') + "'";
			iw_local = (typeof iwm[i].local == 'string') ? '1' : '0';
			iw_api = "'" + (iwm[i].iw_api || '').replace(re_escape, '\\$1') + "'";
			result += 'INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans, iw_api) VALUES ('+iw_prefix+', '+iw_url+', '+iw_local+', 0, '+iw_api+');\n'
		}
		$('<textarea style="width:800px;height:400px;"/>').val(result).appendTo(document.body);
	});
}

$(ExtractInterwikiMapTable);


Ver também