Manual:Interwiki

This page is a translated version of the page Manual:Interwiki and the translation is 52% complete.
Outdated translations are marked like this.

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

As hiperligações Interwiki tornam possível interligar as páginas da Wikipédia, Wikilivros, Wikinotícias, etc..., ou para o seu próprio projeto wiki em diferentes idiomas. (Consulte Manual:Família de Wikis .)

Uma hiperligação como [[Wikipedia:Main Page]] irá aparecer como isto: Wikipedia:Main Page e redireciona-o para a 'Página Principal' da Wikipédia.

Hiperligações Interwiki para outros projetos

Tabela e API de consulta

As hiperligações interwiki estão alojadas na tabela interwiki da base de dados do MediaWiki. Você pode recuperar a lista interwiki da propriedade interwikimap da API de meta query siteinfo , em outras palavras, fazendo uma solicitação de API como api.php?action=query&meta=siteinfo&siprop=interwikimap

Predefinição

Vários projetos do Wikimedia (e outras wiki) estão preparadas por padrão para a associação com a interwiki, podendo utilizá-los sem necessidade de editar a sua base de dados.

A seguir, tem alguns exemplos de prefixos de interwiki disponíveis (também disponível na Wikipédia, versão 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]]
metawikimedia (before version 1.23: metawikipedia) https://meta.wikimedia.org/wiki/ [[metawikimedia:Main Page]]

A lista completa de prefixos padrões da interwiki está disponível em maintenance/interwiki.list

Consulte m:Ajuda:Associar Interwiki para informação completa sobre como interligar os projetos da Wikimedia.

Em algumas instalações, estes não vêm pré-instalados. Neste caso, tente [[metawikipedia:Main Page|metawikipedia:Página Principal]]

Adicionar um novo site da Web para interligação de interwiki

  • As hiperligações de interwiki são definidas na tabela da base de dados da interwiki.
  • Para modificar estas, terá de editar a base de dados, veja o guia abaixo.

Para facilitar o processo, é recomendado que utilize a extensão "interwiki".

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
Versões do MediaWiki:
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.

INSERT INTO interwiki (iw_prefix, iw_url, iw_api, iw_local, iw_trans, iw_wikiid) 
VALUES ('w', 'https://en.wikipedia.org/wiki/$1', 'https://en.wikipedia.org/w/api.php', 0, 1, '');

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:

  • Vá para o seu site,
  • crie 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 campo

Further information: Manual:Interwiki table


  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


  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.


Hiperligações de interwiki para outros idiomas

 
Hiperligações de 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 *iw_prefix: prefixo de idioma (language-prefix, por exemplo "de" para alemão), este é listado em "Names.php"
iw_url *iw_url: URL para o seu projeto wiki (por exemplo, nowiki>http://de.example.org/index.php/http://de.example.org/index.php/$1</nowiki>)
iw_local *iw_local: igual ao de cima "Adicionar Mais"
iw_trans *iw_trans: igual ao de cima "Adicionar Mais"

Agora, pode interligar um artigo ao mesmo em outros idiomas. Adicionando [[de:Hauptseite]] na página principal em inglês (Main_Page), irá criar o link "Deutsch" abaixo da caixa de ferramentas, que leva à página principal do wiki alemão

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 following JavaScript code performs the API query to retrieve the interwiki map of an existing wiki, then displays the SQL INSERT statements to fill the interwiki table on a new wiki. You run it for example by injecting the code through your browser's developer tools, or by 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);

Consulte também