<a id="xliff"></a>

# XLIFF 1.1 and 1.2

<a id="index-0"></a>

#### NOTE
[XLIFF 2.0](https://docs.weblate.org/ro/latest/formats/xliff2.md) is a different format and is not backwards compatible with XLIFF 1.2.

Format bazat pe XML creat pentru a standardiza fișierele de traducere, dar în cele din urmă este unul dintre [multele standarde](https://xkcd.com/927/), în acest domeniu.

XML Localization Interchange File Format (XLIFF) este de obicei folosit ca bilingv, dar Weblate îl acceptă și ca monolingv.

Weblate acceptă XLIFF în mai multe variante:

XLIFF 1.2 translation file
: Standard XLIFF file. Placeables handling is controlled by the
  `xliff_placeables` [File format parameters](https://docs.weblate.org/ro/latest/formats.md#file-format-params).

XLIFF 1.2 with gettext extensions
: XLIFF îmbogățit de [XLIFF 1.2 Representation Guide for Gettext PO](https://docs.oasis-open.org/xliff/v1.2/xliff-profile-po/xliff-profile-po-1.2-cd02.html) pentru a suporta pluralul.

XLIFF 1.2 with Apple extensions
: XLIFF enriched by Apple to support plurals.

#### SEE ALSO
* [XML Localization Interchange File Format (XLIFF)](https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html) specification
* [XLIFF 1.2 Representation Guide for Gettext PO](https://docs.oasis-open.org/xliff/v1.2/xliff-profile-po/xliff-profile-po-1.2-cd02.html)
* [XLIFF on Wikipedia](https://en.wikipedia.org/wiki/XLIFF)
* [XLIFF](https://docs.translatehouse.org/projects/translate-toolkit/en/latest/formats/xliff.html)

## Statele de traducere

Atributul `state` din fișier este parțial procesat și mapat la starea „Needs edit” din Weblate (următoarele stări sunt folosite pentru a marca șirul ca necesitând editare dacă există o țintă prezentă: `new`, `needs-translation`, `needs-adaptation`, `needs-l10n`). În cazul în care atributul `state` lipsește, un șir este considerat tradus de îndată ce există un element `<target>`.

Dacă șirul de traducere are `approved="yes"`, acesta va fi, de asemenea, importat în Weblate ca „Approved”, orice altceva va fi importat ca „Waiting for review” (care corespunde specificației XLIFF).

În timpul salvării, Weblate nu adaugă aceste atribute decât dacă este necesar:

* Atributul `state` este adăugat numai în cazul în care șirul este marcat ca necesitând editare.
* Atributul `approved` se adaugă numai în cazul în care șirul a fost revizuit.
* În alte cazuri, atributele nu sunt adăugate, dar sunt actualizate în cazul în care sunt prezente.

Aceasta înseamnă că, atunci când se utilizează formatul XLIFF, se recomandă cu tărie activarea procesului de revizuire Weblate, pentru a vedea și modifica starea aprobată a șirurilor de caractere.

În mod similar, atunci când importați astfel de fișiere (în formularul de încărcare), trebuie să alegeți Import as translated sub Procesarea șirurilor de caractere care necesită editare.

#### SEE ALSO
[Recenzori dedicați](https://docs.weblate.org/ro/latest/workflows.md#reviews)

## Spațiu alb și linii noi în XLIFF

Use the `xml_utf8_bom`, `xml_encoding_case`, and `xml_final_newline`
[File format parameters](https://docs.weblate.org/ro/latest/formats.md#file-format-params) 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`
[File format parameters](https://docs.weblate.org/ro/latest/formats.md#file-format-params) for XLIFF components:

* Follow xml:space — honor `xml:space` attributes 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"`:

```xml
    <trans-unit id="10" approved="yes">
        <source xml:space="preserve">hello</source>
        <target xml:space="preserve">Hello, world!
</target>
    </trans-unit>
```

#### SEE ALSO
[File format parameters](https://docs.weblate.org/ro/latest/formats.md#file-format-params)

## Placeables in XLIFF

Weblate controls how XML elements inside XLIFF content are handled with the
`xliff_placeables` [File format parameters](https://docs.weblate.org/ro/latest/formats.md#file-format-params):

* 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.

#### SEE ALSO
[File format parameters](https://docs.weblate.org/ro/latest/formats.md#file-format-params)

<a id="xliff-flags"></a>

## Specificarea indicatoarelor de traducere

Puteți specifica indicatori de traducere suplimentari (a se vedea [Personalizarea comportamentului cu ajutorul stegulețelor](https://docs.weblate.org/ro/latest/admin/checks.md#custom-checks)) utilizând atributul `weblate-flags`. Weblate înțelege, de asemenea, atributele `maxwidth` și `font` din specificația XLIFF:

```xml
<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>
```

Atributul `font` este analizat pentru familia, dimensiunea și greutatea fontului, exemplul de mai sus arată toate acestea, deși este necesară doar familia fontului. Orice spațiu în alb din familia de fonturi este convertit în caractere de subliniere, astfel încât `Source Sans Pro` devine `Source_Sans_Pro`, vă rugăm să țineți cont de acest lucru atunci când numiți grupul de fonturi (a se vedea [Gestionarea fonturilor](https://docs.weblate.org/ro/latest/admin/checks.md#fonts)).

#### SEE ALSO
* [font attribute in XLIFF 1.2](https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#font)
* [maxwidth attribute in XLIFF 1.2](https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#maxwidth)

## Chei de șiruri

Weblate identifică unitățile din fișierul XLIFF prin atributul `resname` în cazul în care acesta este prezent și revine la `id` (împreună cu tag-ul `file``, dacă este prezent).

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.

## Example files

Example XLIFF file:

```xml
<?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 &lt;https://demo.weblate.org/&gt;!
</source>
            </trans-unit>
            <trans-unit>
                <source>Thank you for using Weblate.</source>
            </trans-unit>
        </body>
    </file>
</xliff>
```

<!-- AUTOGENERATED START: format-features xliff -->
<!-- This section is automatically generated by `./manage.py list_format_features`. Do not edit manually. -->

#### Supported features

| File extensions                                                                                      | `.mxliff`, `.poxliff`, `.sdlxliff`, `.xlf`, `.xliff`   |
|------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
| Linguality [ⓘ](https://docs.weblate.org/ro/latest/formats.md#bimono)                                   | Both monolingual and bilingual                         |
| Supports plural [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-plurals)                      | `Yes`                                                  |
| Supports descriptions [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-description)            | `Yes`                                                  |
| Supports explanation [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-explanation)             | `No`                                                   |
| Supports context [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-context)                     | `Yes`                                                  |
| Supports location [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-location)                   | `Yes`                                                  |
| Supports line number [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-line-number)             | `No`                                                   |
| Supports flags [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-flags)                         | `Yes`                                                  |
| Additional states [ⓘ](https://docs.weblate.org/ro/latest/formats.md#format-states)                     | `Approved`, `Needs editing`                            |
| API identifier                                                                                       | `apple-xliff`, `poxliff`, `xliff`                      |
| Supports read-only strings [ⓘ](https://docs.weblate.org/ro/latest/formats.md#read-only-strings)        | `Yes`                                                  |
| Supports removing obsolete strings [ⓘ](https://docs.weblate.org/ro/latest/formats.md#obsolete-strings) | `No`                                                   |
<!-- AUTOGENERATED END: format-features xliff -->

## Configurație Weblate

|                                    | Tipic Weblate [Configurația componentei](https://docs.weblate.org/ro/latest/admin/projects.md#component) pentru XLIFF bilingv   |
|------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| Mască de fișier                    | `localizations/*.xliff`                                                                                                |
| Fișier de limbă de bază monolingvă | Gol                                                                                                                    |
| Șablon pentru traduceri noi        | `localizations/en-US.xliff`                                                                                            |
| Format fișier                      | XLIFF Fișier de traducere                                                                                              |

|                                    | Tipic Weblate [Configurația componentei](https://docs.weblate.org/ro/latest/admin/projects.md#component) pentru XLIFF monolingv   |
|------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| Mască de fișier                    | `localizations/*.xliff`                                                                                                  |
| Fișier de limbă de bază monolingvă | `localizations/en-US.xliff`                                                                                              |
| Șablon pentru traduceri noi        | `localizations/en-US.xliff`                                                                                              |
| Format fișier                      | XLIFF Fișier de traducere                                                                                                |
