Extensão:Babel

From mediawiki.org
This page is a translated version of the page Extension:Babel and the translation is 48% complete.
Manual de extensões do MediaWiki
Babel
Estado da versão: estável
Implementação Função de análise sintática
Descrição Adicione uma função de analisador para informar aos outros usuários sobre proficiência linguística e categorizar os usuários dos mesmos níveis e idiomas.
Autor(es) Robert Leverington (RobertLdiscussão)
Última versão Continuous updates
Política de
compatibilidade
Master maintains backward compatibility.
MediaWiki >= 1.40.0
Modifica o banco
de dados
Sim
Composer mediawiki/babel
Tabelas babel
Licença GNU GPL (Licença Pública Geral) 2.0 ou superior
Download Incluído no Pacote de Extensão de Idioma
Exemplo Translatewiki.net
  • $wgBabelMainCategory
  • $wgBabelCategorizeNamespaces
  • $wgBabelDefaultLevel
  • $wgBabelCentralDb
  • $wgBabelAutoCreate
  • $wgBabelCategoryNames
  • $wgBabelAllowOverride
  • $wgBabelUseUserLanguage
Quarterly downloads 89 (Ranked 67th)
Public wikis using 2,416 (Ranked 192nd)
Para traduzir a extensão Babel, verifique sua disponibilidade no translatewiki.net
Problemas Tarefas em aberto · Relatar um bug

A extensão Babel adiciona uma função de analisador para substituir o antigo sistema Babel que completamente contava com predefinições. Se um parâmetro de idioma não reconhecido for especificado, ele vai verificar se existe uma predefinição existente com o nome e a incluirá.

Em projetos da Wikimedia, o substantivo Babel (em referência a Torre de Babel) refere-se aos textos nas páginas do usuário que ajudam a comunicação multilíngue, tornando mais fácil entrar em contato com alguém que fala um determinado idioma. A ideia teve origem no Wikimedia Commons e também foi implementado em muitos outros wikis.

Instalação

  • Baixe e coloque o(s) arquivo(s) num diretório chamado Babel na sua pasta extensions/.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel
  • Adicione o seguinte código ao final do seu arquivo LocalSettings.php :
    wfLoadExtension( 'Babel' );
    
  • Execute o script de atualização que criará automaticamente as tabelas de banco de dados necessárias a essa extensão.
  • Configure conforme necessário.
  • Yes Concluído – Navegue à página Special:Version em sua wiki para verificar se a instalação da extensão foi bem sucedida.
  • O CSS está localizado no arquivo resources/ext.babel.css. Você pode alterar o estilo conforme desejado, substituindo-os na página MediaWiki:Common.css.
  • If the CLDR extension is found language names are taken from that (where translations are unavailable), otherwise built in MediaWiki language names and English defaults are used.

Uso

O sintaxe do #babel parser function é um segue:

 {{#babel: babelcode1 | babelcode2 | ... }}

Adicione um dos seguintes códigos para cada idioma que você fala ou entende, separados por |, onde xx é o código do idioma MediaWiki, código ISO 639-1 ou código ISO 639-3 para o idioma. O uso geral de cada nível de código é o seguinte:

xx-0
Se você não entende o idioma.
xx-1
Habilidade básica - o suficiente para entender o material escrito ou perguntas simples neste idioma.
xx-2
Habilidade intermediária - o suficiente para edição ou discussões.
xx-3
Nível avançado - embora você possa escrever neste idioma sem problemas, alguns pequenos erros podem ocorrer.
xx-4
Nível "quase nativo" - embora não seja sua primeira língua desde o nascimento, sua habilidade é parecida com a de um falante nativo.
xx-5
Proficiência profissional.
xx ou xx-N
Falantes nativos que usam o idioma todos os dias e compreendem perfeitamente, incluindo coloquialismos e expressões idiomáticas.

To include any other template, simply add the name of the template, e.g., add User CSS if you want to include Template:User CSS. A prefix or suffix may be added to template names (e.g. User at the beginning) depending on the local configuration. This can be used to restrict the selection and reduce the length of parameters; for example CSS could include Template:User CSS if configured in such a way.

Parameters

Para remover o cabeçalho e rodapé, use plain=1 como o primeiro parâmetro, por exemplo {{#babel: plain=1 | babelcode1 | babelcode2 | ... }}. Isso torna mais fácil usar o babel com outras caixas de usuário.

To hide categories, use the nocat=1 parameter as the first parameter, e.g., {{#babel: nocat=1 | babelcode1 | babelcode2 | ... }}.

Please note that only one of the parameters above is allowed. At the moment it is not possible to use both parameters, for example, {{#babel: nocat=1 | plain=1 | babelcode1 | babelcode2 | ... }} will not work.

Categorization

If categorization is enabled, the extension creates categories using the Babel AutoCreate bot with the text specified in MediaWiki:babel-autocreate-text-levels and MediaWiki:babel-autocreate-text-main. With basic settings, the categories that the bot creates are not categorized and to fix this, it is recommended to do the following:

  1. Create a template {{Babel category }} that will generate categories.
  2. Replacing text on MediaWiki:babel-autocreate-text-levels with
    {{Babel category|level=$1|language=$2|ISO=$3}}
    
  3. Replacing text on MediaWiki:babel-autocreate-text-main with
    {{Babel category|language=$1|ISO=$2}}
    

This will allow you to automatically categorize categories and if something happens, then simultaneously replace the categorization and text in all categories at the same time.


Configuração

Parâmetros de configuração

O Babel tem seis parâmetros de configuração que podem ser modificados em LocalSettings.php .

$wgBabelLanguageCodesCdb
(string) the path of the language code database file, the default should suffice.
$wgBabelLanguageNamesCdb
(string) the path of the language name database file, the default should suffice.
$wgBabelCategoryNames
(array of string or boolean, indexed by the strings "1", "2", … "5", "N") where each entry is the name of a category for the skill level indicated by its index, possible variable elements are: %code% (language code), %wikiname% (the name of the language in the wiki's content language), and %nativename% (the name of the language in its language). To disable adding a category for a particular level, set the corresponding value to false.
Por exemplo:
$wgBabelCategoryNames = [
	'0' => 'User %code%-0',
	'1' => 'User %code%-1',
	'2' => 'User %code%-2',
	'3' => 'User %code%-3',
	'4' => 'User %code%-4',
	'5' => 'User %code%-5',
	'N' => 'User %code%-N',
];
will use categories like "Category:User en-0" and "Category:User fr-N". The default is just "Category:Fr-N" and so on.
$wgBabelMainCategory
(string) Name of the main (non-level) category for each language, to which all users of that language are added. Set to false to disable; defaults to format "Category:Fr". It accepts the same format as $wgBabelCategoryNames above. Example:
$wgBabelMainCategory = 'User %code%';
$wgBabelDefaultLevel
(string) Default ability level to use when none is specified, should be an index from $wgBabelCategoryNames, that is one of the strings "1", "2", … "5", "N". Default is "N".
$wgBabelUseUserLanguage
(boolean) Whether to use the user interface language for the header and footer message. If false (default), it will be in the page content language. This is because using the user interface language may fragment the parser cache.
$wgBabelCategorizeNamespaces
Array of namespaces to only add automatic categorization to. For example, if $wgBabelCategorizeNamespaces = [ NS_USER ];, then Babel will only add categories to pages in the user namespace. The default is null, which means categorize all namespaces.
$wgBabelCategoryOverride
Whether to allow Babel categories to be overridden on wiki using MediaWiki:Babel-category-override
$wgBabelAutoCreate
Whether to auto-create categories.

Mensagens do sistema

Várias personalizações também podem ser feitas usando mensagens de namespace MediaWiki.

MediaWiki:babel-template "Template:Usuário $1"
The format of template names when one is being included.
MediaWiki:babel-portal ""
The format of the target of the link from the language code. Set to the empty string to not link the language code.
MediaWiki:Babel-autocreate-user "Babel AutoCreate"
Username to be used for autocreation of Babel related categories
MediaWiki:babel-autocreate-text-levels "Os usuários nesta categoria indicam que possuem um nível de conhecimento $1 na língua $2."
Text to insert into auto-created categories for different language levels. You have to change this if you want them to be auto-categorized in the main category of the respective language ($wgBabelMainCategory).
MediaWiki:babel-autocreate-text-main "Os usuários nesta categoria indicam que possuem conhecimento de $1."
Text to insert into auto-created categories for non-level categories. You have to change this if you want them to be auto-categorized in a parent category for all languages.
MediaWiki:babel "Informação do usuário Babel"
O cabeçalho da babel Set to - to not display a header.
MediaWiki:babel-url "Project:Babel"
O nome da página onde as informações sobre a extensão babel podem ser encontradas Set to - to display no link in the header.
MediaWiki:Babel-footer "Usuários por língua"
O rodapé da babel Set to - to not display a footer.
MediaWiki:babel-footer-url " :Categoria:Babel - Usuários por língua"
A página a ser vinculada no rodapé da babel
MediaWiki:Babel-category-override "$1"
Overrides any automatically-generated Babel categories. Parameters:
$1 = the category that would be generated normally.
$2 = the language code
$3 = the babel level.
Any categories overridden using this method will not be auto-created to reduce the risk from vandalism or mistaken edits to that page.

API

meta=babel (bab)

(main | query | babel)

Get information about what languages the user knows

Specific parameter:
Other general parameters are available.
babuser

User to get information about

This parameter is required.
Type: user, by any of username, IP, Temporary user, IP range and interwiki name (e.g. "prefix>ExampleName")
Example:
Get the Babel information for user Example
api.php?action=query&meta=babel&babuser=Example [open in sandbox]