Schriftsysteme/Syntax
- Übersetzte Version von zh:Help:高级字词转换语法
Diese Seite beschreibt spezielle Markierungen aus LanguageConverter, ein System, das Sprachvarianten konvertiert mithilfe von Buchstaben-/Wortersetzung. In allen Beispielen unten repräsentieren Kleinbuchstaben Vereinfachtes Chinesisch und GROßBUCHSTABEN Traditionelles Chinesisch.
Konzept
LanguageConverter Auszeichnungen sehen folgendermaßen aus:
-{ text }-
-{ flag | variant1 : text1 ; variant2 : text2 ; }-
-{ flag1 ; flag2 | from => variant : to ; }-
Where flags are described below, and variant names are language codes (like zh-cn
or zh-tw
).
Fallback among variants is available.
In den folgenden Beispielen aus dem Chinesischen sind zh-cn
und zh-sg
Varianten in der zh-hans
Schriftart, während zh-hk
und zh-mo
Varianten der zh-hant
Schriftart sind.
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
.
In this example you may notice that zh-mo
and zh-sg
are absent from most examples.
This is due to their high similarity to other variants, zh-hk
and zh-cn
respectively.
Syntax
Grundsyntax
Name | Beschreibung | Beispiel | Hinweis: | |
---|---|---|---|---|
Wikitext | Ausgabe | |||
Bidirektional | Bidirectional conversion with flag support. Most common syntax in manual conversion. |
-{zh-hans:computer; zh-hant:ELECTRONICBRAIN;}- |
|
|
Unidirektional | Unidirectional conversion with flag support. Primär genutzt für das Hinzufügen neuer Umwandlungsregeln. Läuft schneller als bidirektionale Regeln.
Mainly useful for unifying language variance and preventing erratic conversion. |
-{H|HUGEBLOCK=>zh-cn:macro;}- Test: HUGEBLOCK, macro |
|
Fallback is not supported in unidirectional conversion. For example, in the above example, zh-hans and zh-sg won't use zh-cn 's rules. On the other hand, if the rule was inserted into zh-hans , it would only apply to zh-hans , but not zh-cn .
|
Disabled | Disable language conversion |
-{SimpTrad}-
<!--Alternatively, with the "R" flag: -{R|SimpTrad}--->
|
|
This disables conversion completely. |
(Semi-)disabled | 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, chosun
|
There's another way to achieve this, which is more convenient in templates. See "Combined conversion flag" below. Zum Beispiel: -{zh;zh-hans;zh-hant|HANGUK}- -{zh;zh-hans;zh-hant|chosun}-
|
Conversion flags
Common flags
Flag | Beschreibung | Beispiel | Hinweis | |
---|---|---|---|---|
Wikitext | Ausgabe | |||
H | Insert a conversion rule without output |
-{H|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}- Test: blog, WEBJOURNAL, WEBLOG |
|
zh-hans and zh-hant are simply scripts and won't apply bidirectional rules. See also the $manualLevel parameter in LanguageConverter.
|
A | Insert a conversion rule with a result in the current language |
-{A|zh-cn:blog; zh-hk:WEBJOURNAL; zh-tw:WEBLOG;}- -{zh-hans:→; zh-hant:⇒}- blog, WEBJOURNAL, WEBLOG |
|
Compare the first (A) output with the one from H and flag-free operation. |
- | Remove existing conversion rule |
-{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 |
|
Compare test (+), test (-), and basic hans/hant |
T | Override page title |
-{T|zh-cn:tom hanks; zh-hk:SOUP HANS; zh-tw:TOM HANKS;}- (assuming the original title is "TomHanks") |
(shown as page title)
|
|
D | Describe conversion rule |
-{D|zh-cn:tom hanks; zh-hk:SOUP HANS; zh-tw:TOM HANKS}- |
|
Good for generating overviews in public conversion rule-groups. |
Kombinierte Umsetzkennzeichen
Flag | Beschreibung | Beispiel | Hinweis | |
---|---|---|---|---|
Wikitext | Ausgabe | |||
variant name | Only consider certain variants for conversion |
-{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}- (assuming this runs on a Chinese wiki) |
|
Compare test 1, test 2 and the usage case in H flag above. |
Exceptions
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.
This hack can be useful for code samples nested in these 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.
MediaWiki messages are not processed by LC. This inconvenience is tracked in T170916.
Siehe auch
- Hilfe:Magische Wörter - for switches related to the converter
- Parsoid/Language conversion - which collects additional documentation relating to Language Conversion