Escrever o Sistema/Sintaxe

From mediawiki.org
This page is a translated version of the page Writing systems/Syntax and the translation is 68% complete.
Outdated translations are marked like this.
Versão da Tradução do zh:Help:高级字词转换语法

Esta página descreve marcações especiais encontradas em LanguageConverter, um sistema que converte entre variantes de idioma por meio de substituição de caracteres/palavras. Em todos os exemplos abaixo, caracteres em minúsculas são usados para representar chinês simplificado e maiúsculas representam chinês tradicional.

Conceito

LanguageConverter as marcações se parecem com:

  • -{ text }-
  • -{ flag | variant1 : text1 ; variant2 : text2 ; }-
  • -{ flag1 ; flag2 | from => variant : to ; }-

Onde os sinalizadores são descritos abaixo e os nomes das variantes são códigos de idioma (como zh-cn ou zh-tw).

O fallback entre variantes está disponível. Nos exemplos a seguir projetados para chinês, zh-cn e zh-sg são variantes escritas no script zh-hans, enquanto zh-hk, zh-mo são variantes escritas no script zh-hant. Por exemplo, de acordo com a definição em $variantfallbacks LanguageZh.php, se nenhuma regra para zh-hk fosse encontrada, o conversor tentaria usar definições para zh-hant, zh-mo e zh-tw. In the following examples designed for Chinese, zh-cn and zh-sg are variants written in the zh-hans script, while zh-hk, zh-mo are variants written in the zh-hant script. For example, according to the $variantfallbacks definition in LanguageZh.php, if no rules for zh-hk were found, the converter would try using definitions for zh-hant, zh-mo, and zh-tw.

Neste exemplo, você pode notar que zh-mo e zh-sg estão ausentes na maioria dos exemplos. Isso se deve à alta semelhança com outras variantes, zh-hk e zh-cn, respectivamente. This is due to their high similarity to other variants, zh-hk and zh-cn respectively.

Sintaxe

Sintaxe básica

Nome Descrição Exemplo Nota
Wikitexto Saída
Bidirecional Conversão bidirecional com suporte flag. Sintaxe mais comum na conversão manual.
-{zh-hans:computer; zh-hant:ELECTRONICBRAIN;}-
zh, zh-hans, zh-cn, zh-sg
computer
zh-hant, zh-tw, zh-hk, zh-mo
ELECTRONICBRAIN
Unidirecional Conversão unidirecional com suporte flag. Usado principalmente para adicionar novas regras de conversão. Executa mais rápido que as regras bidirecionais.

Principalmente útil para unificar a variação de idioma e impedir a conversão errática.

-{H|HUGEBLOCK=>zh-cn:macro;}-
Test: HUGEBLOCK, macro
zh
Test: HUGEBLOCK, Macro
zh-hans, zh-sg
test: hugeblock, macro
zh-hant, zh-hk, zh-tw
TEST: HUGEBLOCK, MACRO
zh-cn
test: macro, macro
O fallback não é suportado na conversão unidirecional. Por exemplo, no exemplo acima, zh-hans e zh-sg não usarão as regras de zh-cn. Por outro lado, se a regra fosse inserida em zh-hans, ela se aplicaria apenas a zh-hans, mas não a zh-cn.
Desativado Desativar conversão de idioma
-{SimpTrad}-
<!--Como alternativa, com a bandeira "R": -{R|SimpTrad}--->
(all variants)
SimpTrad
Isso desativa a conversão completamente.
(Semi-)desativado Disable "word" conversion
(breaking words apart, won't affect character transcription)

Useful for stopping erratic conversion by splitting words correctly.

HAN-{}-GUK, cho-{}-sun

(assuming there's a system-wide conversion rule between HANGUK and chosun)

zh
HANGUK, chosun
zh-hans, zh-cn, zh-sg

hanguk, chosun

zh-hant, zh-hk, zh-tw
HANGUK, CHOSUN
There's another way to achieve this, which is more convenient in templates. See "Combined conversion flag" below.
Por exemplo: -{zh;zh-hans;zh-hant|HANGUK}- -{zh;zh-hans;zh-hant|chosun}-

Sinalizadores de conversão

Bandeiras comuns

Flag Descrição Exemplo Nota
Wikitexto Saída
H Inserir uma regra de conversão sem saída
-{H|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}-
Test: blog, WEBJOURNAL, WEBLOG
zh
Test: blog, WEBJOURNAL, WEBLOG
zh-hans
test: blog, webjournal, weblog
zh-hant
TEST: BLOG, WEBJOURNAL, WEBLOG
zh-cn, zh-sg
test: blog, blog, blog
zh-hk
TEST: WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
zh-tw
TEST: WEBLOG, WEBLOG, WEBLOG
zh-hans and zh-hant are simply scripts and won't apply bidirectional rules. See also the $manualLevel parameter in LanguageConverter.
A Inserir uma regra de conversão com um resultado no idioma atual
-{A|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}-
-{zh-hans:→; zh-hant:⇒}-
blog, WEBJOURNAL, WEBLOG
zh
blog → blog, WEBJOURNAL, WEBLOG
zh-hans
blog → blog, webjournal, weblog
zh-hant
WEBLOG ⇒ BLOG, WEBJOURNAL, WEBLOG
zh-cn, zh-sg
blog → blog, blog, blog
zh-hk
WEBJOURNAL ⇒ WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
zh-tw
WEBLOG ⇒ WEBLOG, WEBLOG, WEBLOG
Compare the first (A) output with the one from H and flag-free operation.
- Remover regra de conversão existente
-{H|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}- <!-- Add rule -->
+ blog, WEBJOURNAL, WEBLOG

-{-|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}- <!-- Remove rule -->
- blog, WEBJOURNAL, WEBLOG
zh
+ blog, WEBJOURNAL, WEBLOG
- blog, WEBJOURNAL, WEBLOG
zh-hans
+ blog, webjournal, weblog
- blog, webjournal, weblog
zh-hant
+ BLOG, WEBJOURNAL, WEBLOG
- BLOG, WEBJOURNAL, WEBLOG
zh-cn, zh-sg
+ blog, blog, blog
- blog, webjournal, weblog
zh-hk
+ WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
- BLOG, WEBJOURNAL, WEBLOG
zh-tw
+ WEBLOG, WEBLOG, WEBLOG
- BLOG, WEBJOURNAL, WEBLOG
Compare test (+), test (-), and basic hans/hant
T Substituir título da página
-{T|zh-cn:tom hanks; zh-hk:SOUP HANS; zh-tw:TOM HANKS;}-

(supondo que o título original seja "TomHanks")

(mostrado como título da página)
zh (gerrit:19746)
TomHanks
zh-hans, zh-cn, zh-sg
tom hanks
zh-hk
SOUP HANS
zh-tw
TOM HANKS
D Descrever regra de conversão
-{D|zh-cn:tom hanks; zh-hk:SOUP HANS; zh-tw:TOM HANKS}-
(all variants)
China: tom hanks; Hong Kong: SOUP HANS; Taiwan: TOM HANKS
Bom para gerar visões gerais em grupos de regras de conversão pública.

Sinalizador de conversão combinado

Flag Descrição Exemplo: Notas
Wikitexto Saída
nome da variante Considere apenas determinadas variantes para conversão
-{H|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}-
Test 1: -{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-

Test 2: -{zh;zh-cn;zh-hk|blog, WEBJOURNAL, WEBLOG}-

(supondo que isso seja executado em uma wiki em chinês)

zh
Test 1: blog, WEBJOURNAL, WEBLOG
Test 2: blog, WEBJOURNAL, WEBLOG
zh-hans
test 1: blog, webjournal, weblog
test 2: blog, blog, blog
zh-hant, zh-tw
TEST 1: BLOG, WEBJOURNAL, WEBLOG
TEST 2: WEBLOG, WEBLOG, WEBLOG
zh-cn, zh-sg
test 1: blog, webjournal, weblog
test 2: blog, blog, blog
zh-hk
TEST 1: BLOG, WEBJOURNAL, WEBLOG
TEST 2: WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
Compare o teste 1, teste 2 e o caso de uso no sinalizador H acima.

Exceções

Language converter avoids converting anything found in "code" blocks like ‎<pre>...‎</pre>, ‎<code>...‎</code>, as well as the ‎<script>...‎</script> tag used for carrying executable JavaScript. Putting an empty conversion rule block -{}- inside these tags will function as a "force convert" switch for the converter. Esse hack pode ser útil para amostras de código aninhadas nessas tags.

A caveat, however, is that this switch doesn't seem to work for the extension-provided ‎<syntaxhighlight> tags which eventually generates a ‎<pre>...‎</pre> nested with elements (T34943). The switch also won't work with scripts not originally included with the page's HTML source that LC is designed to operate on.

As mensagens do MediaWiki não são processadas pelo LC. Esse inconveniente é rastreado em T170916. This inconvenience is tracked in T170916.

Ver também