XLIFF#
Bemerkung
Weblate currently supports XLIFF 1.2. XLIFF 2.0 is not supported and is not backwards compatible with XLIFF 1.2.
XML-based format created to standardize translation files, but in the end it is one of many standards, in this area.
XML Localization Interchange File Format (XLIFF) is usually used as bilingual, but Weblate supports it as monolingual as well.
Weblate unterstützt XLIFF in mehreren Varianten:
- XLIFF 1.2-Übersetzungsdatei
Einfache XLIFF-Datei, in welcher der Inhalt der Elemente als reiner Text gespeichert ist (alle XML-Elemente sind maskiert).
- XLIFF 1.2 mit Platzhalterunterstützung
Standard-XLIFF mit Platzhalterunterstützung und anderen XML-Elementen.
- XLIFF 1.2 mit Gettext-Erweiterungen
XLIFF enriched by XLIFF 1.2 Representation Guide for Gettext PO to support plurals.
Siehe auch
XML Localization Interchange File Format (XLIFF) specification, XLIFF 1.2 Representation Guide for Gettext PO, XLIFF on Wikipedia, XLIFF,
Übersetzungsstatus#
The state
attribute in the file is partially processed and mapped to the
„Needs edit“ state in Weblate (the following states are used to flag the string as
needing edit if there is a target present: new
, needs-translation
,
needs-adaptation
, needs-l10n
). Should the state
attribute be
missing, a string is considered translated as soon as a <target>
element
exists.
Wenn die Übersetzungszeichenkette approved="yes"
hat, wird sie auch in Weblate als „Genehmigt“ importiert, alles andere wird als „Überprüfung ausstehend“ importiert (dies entspricht der XLIFF-Spezifikation).
While saving, Weblate doesn’t add those attributes unless necessary:
The
state
attribute is only added in case string is marked as needing edit.The
approved
attribute is only added in case string has been reviewed.In other cases the attributes are not added, but they are updated in case they are present.
That means that when using the XLIFF format, it is strongly recommended to turn on the Weblate review process, in order to see and change the approved state of strings.
Similarly upon importing such files (in the upload form), you should choose Import as translated under Processing of strings needing edit.
Siehe auch
Leerzeichen und Zeilenumbrüche in XLIFF#
Generally types or amounts of whitespace is not differentiated between in XML formats.
If you want to keep it, you have to add the xml:space="preserve"
flag to
the string.
Zum Beispiel:
<trans-unit id="10" approved="yes">
<source xml:space="preserve">hello</source>
<target xml:space="preserve">Hello, world!
</target>
</trans-unit>
Specifying translation flags#
You can specify additional translation flags (see Anpassen des Verhaltens mit Markierungen) by
using the weblate-flags
attribute. Weblate also understands maxwidth
and font
attributes from the XLIFF specification:
<trans-unit id="10" maxwidth="100" size-unit="pixel" font="ubuntu;22;bold">
<source>Hello %s</source>
</trans-unit>
<trans-unit id="20" maxwidth="100" size-unit="char" weblate-flags="c-format">
<source>Hello %s</source>
</trans-unit>
Das Attribut font
wird nach Schriftfamilie, -größe und -gewicht analysiert, das obige Beispiel zeigt all das, obwohl nur die Schriftfamilie erforderlich ist. Jedes Leerzeichen in der Schriftfamilie wird in einen Unterstrich umgewandelt, so wird Source Sans Pro
zu Source_Sans_Pro
, bitte beachten Sie dies bei der Benennung der Schriftgruppe (siehe Schriftarten verwalten).
Zeichenkettenschlüssel#
Weblate identifies the units in the XLIFF file by resname
attribute in case
it is present and falls back to id
(together with file
tag if present).
The resname
attribute is supposed to be human friendly identifier of the
unit making it more suitable for Weblate to display instead of id
. The
resname
has to be unique in the whole XLIFF file. This is required by
Weblate and is not covered by the XLIFF standard - it does not put any
uniqueness restrictions on this attribute.
Weblate-Konfiguration#
Typical Weblate Komponentenkonfiguration for bilingual XLIFF |
|
---|---|
Dateimaske |
|
Einsprachige Basissprachdatei |
Leer |
Vorlage für neue Übersetzungen |
|
Dateiformat |
XLIFF-Übersetzungsdatei |
Typical Weblate Komponentenkonfiguration for monolingual XLIFF |
|
---|---|
Dateimaske |
|
Einsprachige Basissprachdatei |
|
Vorlage für neue Übersetzungen |
|
Dateiformat |
XLIFF-Übersetzungsdatei |