XLIFF 1.1 i 1.2¶
Nota
XLIFF 2.0 és un format diferent i no és compatible amb XLIFF 1.2.
XML-based format created to standardize translation files, but in the end it is one of many standards, in this area.
El format de fitxer d’intercanvi de localització XML (XLIFF) s’utilitza normalment com a bilingüe, però Weblate també l’admet com a monolingüe.
Weblate supports XLIFF in several variants:
- XLIFF 1.2 translation file
Standard XLIFF file. Placeables handling is controlled by the
xliff_placeablesParàmetres del format de fitxer.- XLIFF 1.2 with gettext extensions
XLIFF enriquit amb XLIFF 1.2 Representation Guide for Gettext PO per admetre plurals.
- XLIFF 1.2 with Apple extensions
XLIFF enriquit per Apple per donar suport als plurals.
Vegeu també
Estats de traducció¶
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.
Si la cadena de traducció té approved="yes", també s’importarà a Weblate com a «Aprovat», qualsevol altra cosa s’importarà com a «En espera de revisió» (que coincideix amb l’especificació XLIFF).
Mentre es desa, Weblate no afegeix aquests atributs tret que sigui necessari:
L’atribut
statenomés s’afegeix en cas que la cadena estigui marcada com a necessitat d’edició.L’atribut
approvednomés s’afegeix en cas que s’ha revisat la cadena.En altres casos, els atributs no s’afegeixen, però s’actualitzen en cas que estiguin presents.
Això vol dir que quan s’utilitza el format XLIFF, és molt recomanable activar el procés de revisió de Weblate per veure i canviar l’estat aprovat de les cadenes.
De la mateixa manera, en importar aquests fitxers (al formulari de càrrega), hauríeu de triar Importa com a traduït a Processament de cadenes que necessiten editar.
Vegeu també
Espais en blanc i línies noves a XLIFF¶
Use the xml_utf8_bom, xml_encoding_case, and xml_final_newline
Paràmetres del format de fitxer to control the byte order mark, declaration encoding
case, and final newline when writing XLIFF files.
Weblate controls how whitespaces are handled with the xml_whitespace_handling
Paràmetres del format de fitxer for XLIFF components:
Follow xml:space — honor
xml:spaceattributes in the file (and the XLIFF default when the attribute is missing).Always preserve — keep all whitespace and set
xml:space="preserve"on units (Weblate’s default for new units).Always normalize — collapse whitespace even when the file sets
xml:space="preserve".
To keep newlines or surrounding spaces when following xml:space, mark the
string with xml:space="preserve":
<trans-unit id="10" approved="yes">
<source xml:space="preserve">hello</source>
<target xml:space="preserve">Hello, world!
</target>
</trans-unit>
Vegeu també
Placeables in XLIFF¶
Weblate controls how XML elements inside XLIFF content are handled with the
xliff_placeables Paràmetres del format de fitxer:
Plain text — escape XML elements in the content.
Placeables — preserve placeables and other XML elements (the default). Tags then appear as placeholders in the editor.
Vegeu també
Especificació de marques de traducció¶
Podeu especificar marques de traducció addicionals (vegeu Personalització del comportament mitjançant banderes) utilitzant l’atribut weblate-flags. Weblate també entén els atributs maxwidth i font de l’especificació XLIFF:
<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>
L’atribut font s’analitza per a la família de tipus de lletra, la mida i el pes, l’exemple anterior mostra tot això, encara que només es requereix una família de tipus de lletra. Qualsevol espai en blanc de la família de tipus de lletra es converteix en guió baix, de manera que Source Sans Pro es converteix en Source_Sans_Pro, si us plau, tingueu-ho en compte quan anomeneu el grup de fonts (vegeu Gestió de tipus de lletra).
Vegeu també
String keys¶
Weblate identifica les unitats del fitxer XLIFF mitjançant l’atribut resname en cas que estigui present i torna a id (juntament amb l’etiqueta file si està present).
Se suposa que l’atribut resname és un identificador amigable per a persones de la unitat, fent-lo més adequat perquè Weblate es mostri en lloc de id. El resname ha de ser únic a tot el fitxer XLIFF. Això és requerit per Weblate i no està cobert per l’estàndard XLIFF; no imposa cap restricció d’unicitat a aquest atribut.
Example files¶
Example XLIFF file:
<?xml version='1.0' encoding='UTF-8'?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.1">
<file>
<body>
<trans-unit weblate-flags="c-format, max-length:100">
<source xml:space="preserve">Hello, world!
</source>
</trans-unit>
<trans-unit>
<source xml:space="preserve">Orangutan has %d banana.
</source>
</trans-unit>
<trans-unit>
<source xml:space="preserve">Try Weblate at <https://demo.weblate.org/>!
</source>
</trans-unit>
<trans-unit>
<source>Thank you for using Weblate.</source>
</trans-unit>
</body>
</file>
</xliff>
File extensions |
|
|---|---|
Lingualitat ⓘ |
Both monolingual and bilingual |
Supports plural ⓘ |
|
Supports descriptions ⓘ |
|
Admet l’explicació ⓘ |
|
Supports context ⓘ |
|
Supports location ⓘ |
|
Supports flags ⓘ |
|
Additional states ⓘ |
|
API identifier |
|
Admet cadenes de només lectura ⓘ |
|
Supports removing obsolete strings ⓘ |
|
Configuració del Weblate¶
Placa web típica Configuració dels components per a XLIFF bilingüe |
|
|---|---|
Filtre de fitxers |
|
Fitxer de llengua base monolingüe |
«Buit». |
Plantilla per a traduccions noves |
|
Format de fitxer |
Fitxer de traducció XLIFF |
Placa web típica Configuració dels components per a XLIFF monolingüe |
|
|---|---|
Filtre de fitxers |
|
Fitxer de llengua base monolingüe |
|
Plantilla per a traduccions noves |
|
Format de fitxer |
Fitxer de traducció XLIFF |