Jump to content

Sistemas de escritura/Sintaxis

From mediawiki.org
This page is a translated version of the page Writing systems/Syntax and the translation is 92% complete.
Outdated translations are marked like this.
Versión traducida de zh:Help:高级字词转换语法

Esta página describe marcas especiales que se encuentran en LanguageConverter, un sistema que convierte entre variantes de idioma mediante el reemplazo de caracteres/palabras. En todos los ejemplos siguientes, los caracteres en minúsculas se utilizan para representar el chino simplificado y las MAYÚSCULAS representan el chino tradicional.

Some example characters you can use for testing:

TRADITIONAL simplified Transliteration

(Pinyin)

Meaning
air
horse
diàn electricity

Concepto

Las marcas de LanguageConverter se ven así:

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

Donde las banderas se describen a continuación, y los nombres de las variantes son códigos de idioma (como zh-cn o zh-tw).

Language codes

The examples below use the following language codes:

Code Language Note
zh chino "zh" is the initial consonant of the Mandarin pinyin for the character "中". (China is 中国, Zhōngguó.)
zh-hans chino simplificado hans is an ISO 15924 script code, part of the BCP 47 language tag. "han" is the pinyin for the first character in 汉字 Hànzì (written in simplified characters) which is the autonym of the Chinese script, and "s" is the first letter of "Simplified Chinese".
zh-hant chino tradicional hant is an ISO 15924 script code, part of the BCP 47 language tag. "han" is the pinyin for the first character in 漢字 Hànzì (written in traditional characters) which is the autonym of the Chinese script, and "t" is the first letter of "Traditional Chinese".
zh-cn Mainland China (Simplified) cn is the ISO 3166-1 alpha-2 code for mainland China, part of the BCP 47 language tag.
zh-hk Hong Kong (Traditional) hk is the ISO 3166-1 alpha-2 code for Hong Kong, part of the BCP 47 language tag.
zh-mo Macau (Traditional) mo is the ISO 3166-1 alpha-2 code for Macau, part of the BCP 47 language tag.
zh-my Malaysia (Simplified) my is the ISO 3166-1 alpha-2 code for Malaysia, part of the BCP 47 language tag.
zh-sg Singapore (Simplified) sg is the ISO 3166-1 alpha-2 code for Singapore, part of the BCP 47 language tag. Malaysia and Singapore were originally covered by a combined variant.
zh-tw Taiwan (Traditional) cn is the ISO 3166-1 alpha-2 code for Taiwan, part of the BCP 47 language tag.

Each LanguageConverter in MediaWiki has a main language code, which serves as the default value when returning article text unmodified. If a language code does not have a fallback language code set, then the main language code is used as its fallback code. Each language version of Wikipedia defines a default language code; for wikis using language converter that default language code is the main language code of its LanguageConverter.

When the selected language code does not have any available display output, MediaWiki will attempt to fallback to another language code to obtain display output.

Backup chain for MediaWiki language codes
Backup chain for MediaWiki language codes

Similarly, when word conversion fails to find a full-text conversion for a certain language code, it will consult the rules for the fallback code to attempt to find a matching conversion.

According to ZhConverter::getVariantsFallbacks() the order of fallback variants is as follows:

Language code Fallback codes
zh-hans zh-cn zh-sg zh-my
zh-hant zh-tw zh-hk zh-mo
zh-cn zh-hans zh-sg zh-my
zh-hk zh-mo zh-hant zh-tw
zh-mo zh-hk zh-hant zh-tw
zh-my zh-sg zh-hans zh-cn
zh-sg zh-my zh-hans zh-cn
zh-tw zh-hant zh-hk zh-mo

The main language code also has fallback codes. The fallback codes for zh are, in order: zh-hans, zh-hant, zh-cn, zh-tw, zh-hk, zh-sg, zh-mo, zh-my.


Sintaxis

Sintaxis básica

Nombre Descripción Ejemplo Nota
Wikitexto Muestra
Bidireccional Conversión bidireccional con soporte de flag. Sintaxis más común en la conversión manual.
-{zh-cn:computer; zh-tw:ELECTRONICBRAIN;}-
zh, zh-hans, zh-cn, zh-my, zh-sg
computer
zh-hant, zh-hk, zh-mo, zh-tw
ELECTRONICBRAIN
Unidireccional Conversión unidireccional con soporte de flag. Se utiliza principalmente para agregar nuevas reglas de conversión. Corre más rápido que las reglas bidireccionales.

Principalmente útil para unificar la variación del idioma y prevenir la conversión errática.

-{H|HUGEBLOCK=>zh-cn:macro;}-
Test: HUGEBLOCK, macro
zh
Test: HUGEBLOCK, Macro
zh-hans, zh-my, zh-sg
test: hugeblock, macro
zh-hant, zh-hk, zh-mo, zh-tw
TEST: HUGEBLOCK, MACRO
zh-cn
test: macro, macro
El respaldo no es compatible con la conversión unidireccional. Por ejemplo, en el ejemplo anterior, zh-hans y zh-sg no usarán las reglas de zh-cn. Por otro lado, si la regla se inserta en zh-hans, solo se aplicaría a zh-hans, pero no a zh-cn.
Desactivado Deshabilitar la conversión de idioma
-{SimpTrad}-

(Alternativamente, con el flag "R": -{R|SimpTrad}--)

(todas las variantes)
SimpTrad
Esto deshabilita la conversión por completo.
(Semi)desactivado Desactivar la conversión de "palabras"
(Separar palabras, no afectará la transcripción de caracteres.)

Útil para detener la conversión errática dividiendo las palabras correctamente.

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

(asumiendo que hay una regla de conversión para todo el sistema entre HANGUK y chosun)

zh
HANGUK, chosun
zh-hans, zh-cn, zh-my, zh-sg
hanguk, chosun
zh-hant, zh-hk, zh-mo, zh-tw
HANGUK, CHOSUN
Hay otra forma de lograr esto, que es más conveniente en las plantillas. Consulte "Flag de conversión combinada" a continuación.
Por ejemplo: -{zh;zh-hans;zh-hant|HANGUK}- -{zh;zh-hans;zh-hant|chosun}-

Flags de conversión

Flags comunes

Note that the actual effect of the inserted rules only takes place after the point where the rule is defined. Therefore it is recommended to place rules (for example, using the zh:Template:NoteTA template) at the beginning of the article and above any preface or infobox. In some cases, however, it is desired to present words in the disambiguation hatnote template from being transformed, in which case the rules should be placed below that.

Flag Descripción Ejemplo Nota
Wikitexto Muestra
H Insertar una regla de conversión sin salida
-{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-my, zh-sg
test: blog, blog, blog
zh-hk, zh-mo
TEST: WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
zh-tw
TEST: WEBLOG, WEBLOG, WEBLOG
zh-hans y zh-hant son simplemente tipos de escritura y no aplicarán reglas bidireccionales. Véase también el parámetro $manualLevel en LanguageConverter.
A Insertar una regla de conversión con un resultado en el idioma actual
-{A|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}-
Test: blog, WEBJOURNAL, WEBLOG
zh
blog
Test: blog, WEBJOURNAL, WEBLOG
zh-hans
blog
test: blog, webjournal, weblog
zh-hant
WEBLOG
TEST: BLOG, WEBJOURNAL, WEBLOG
zh-cn, zh-my, zh-sg
blog
test: blog, blog, blog
zh-hk, zh-mo
WEBJOURNAL
TEST: WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
zh-tw
WEBLOG
TEST: WEBLOG, WEBLOG, WEBLOG
Compare la primera salida (A) con la de H y la operación sin flags.
- Quitar la regla de conversión existente
-{H|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}- <!-- Add a rule -->
+ blog, WEBJOURNAL, WEBLOG

-{-|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}- <!-- Remove a 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-my, zh-sg
+ blog, blog, blog
- blog, webjournal, weblog
zh-hk, zh-mo
+ WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
- BLOG, WEBJOURNAL, WEBLOG
zh-tw
+ WEBLOG, WEBLOG, WEBLOG
- BLOG, WEBJOURNAL, WEBLOG
Comparar prueba (+), prueba (-) y hans/hant básico
T Anular el título de la página
-{T|zh-cn:tom hanks; zh-hk:SOUP HANS; zh-tw:TOM HANKS;}-

(assuming the original title is "TomHanks")(asumiendo que el título original es "TomHanks")

(mostrado como título de la página)
zh (gerrit:19746)
TomHanks
zh-hans, zh-cn, zh-my, zh-sg
tom hanks
zh-hant, zh-tw
TOM HANKS
zh-hk, zh-mo
SOUP HANS
D Describe la regla de conversión
-{D|zh-cn:tom hanks; zh-hk:SOUP HANS; zh-tw:TOM HANKS}-
(all variants)
大陆:tom hanks;香港:SOUP HANS;臺灣:TOM HANKS;
Bueno para generar descripciones generales en grupos de reglas de conversión públicos.

Flag de conversión combinada

Flag Descripción Ejemplo Nota
Wikitexto Muestra
nombre de variante Considere solo ciertas variantes para la conversión
-{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}-

(asumiendo que esto se ejecuta en una wiki china)

zh
Test 1: blog, WEBJOURNAL, WEBLOG
Test 2: blog, WEBJOURNAL, WEBLOG
zh-hans, zh-cn, zh-my, zh-sg
test 1: blog, webjournal, weblog
test 2: blog, blog, blog
zh-hant, zh-hk, zh-mo, zh-tw
TEST 1: BLOG, WEBJOURNAL, WEBLOG
TEST 2: WEBJOURNAL, WEBJOURNAL, WEBJOURNAL
Compare la prueba 1, la prueba 2 y el caso de uso en el indicador H anterior. Used like the example in test 1, this feature can be used in situations where regional terminology conversion should be avoided, but simplified/traditional character conversion is allowed; for example the regional film titles in zh:Template:Infobox Film.

Excepciones

El conversor de lenguaje evita convertir cualquier cosa que se encuentre en bloques de "código" como ‎<pre>...‎</pre>, ‎<code>...‎</code>, así como la etiqueta ‎<script>...‎</script> utilizada para llevar JavaScript ejecutable. Poner un bloqueo de reglas de conversión vacío -{}- dentro de estas etiquetas funcionará como un interruptor de "conversión forzada" para el convertidor. Este truco puede ser útil para muestras de código anidadas en estas etiquetas.

Sin embargo, una advertencia es que este cambio no parece funcionar para las etiquetas ‎<syntaxhighlight> proporcionadas por la extensión, que eventualmente genera un ‎<pre>...‎</pre> anidado con elementos (T34943). El conmutador tampoco funcionará con tipos de escritura que no se incluyeron originalmente con la fuente HTML de la página en la que LC está diseñado para operar.

MediaWiki Los mensajes no son procesados por LC. Este inconveniente se registra en T170916.

Véase también