Localization file formats¶
Weblate supports a wide range of translation formats. Each format is slightly different and provides a different set of capabilities.
Sugestie
When choosing a file format for your application, it’s better to stick to some well-established format in the toolkit/platform you use. This way your translators can additionally use whatever tools they are used to, and will more likely contribute to your project.
Vezi și
Detecție automată¶
Weblate tries to detect file format during Adăugarea de proiecte și componente de traducere. The detection might be wrong for different variants of the same serialization format (JSON, YAML, properties) or file encoding, so please verify that Format fișier is correct before creating the component.
Capabilități ale tipurilor de traducere¶
Please refer to the documentation page of each individual file format for information about which features are supported in that format.
Formate bilingve și monolingve¶
Sunt acceptate atât formatul monolingual, cât și bilingual. Formatele bilingve stochează două limbi într-un singur fișier-sursă și traducere (exemple tipice sunt GNU gettext PO (Portable Object), XLIFF 1.1 and 1.2 sau Șiruri Apple iOS). Pe de altă parte, formatele monolingve identifică șirul de caractere prin ID, iar fiecare fișier de limbă conține doar maparea acestora într-o anumită limbă (tipic Resurse de șiruri Android). Unele formate de fișiere sunt utilizate în ambele variante, a se vedea descrierea detaliată de mai jos.
Pentru utilizarea corectă a fișierelor monolingve, Weblate are nevoie de acces la un fișier care să conțină lista completă a șirurilor de caractere care trebuie traduse împreună cu sursa lor - acest fișier se numește Fișier de limbă de bază monolingvă în Weblate, deși denumirea poate varia în paradigma dumneavoastră.
În plus, acest flux de lucru poate fi extins prin utilizarea Fișier de limbă intermediar pentru a include șiruri de caractere furnizate de dezvoltatori, dar care să nu fie utilizate ca atare în șirurile finale.
String states¶
Many file formats only differentiate „Untranslated” and „Translated” strings. With some formats it is possible to store more fine-grained state information, such as „Needs editing” or „Approved”.
Descriere șir sursă¶
Descrierile șirului sursă pot fi utilizate pentru a transmite informații suplimentare despre șirul de tradus.
Several formats have native support for providing additional info to translators (for example XLIFF 1.1 and 1.2, GNU gettext PO (Portable Object), JSON WebExtension, Fișiere CSV, Excel Open XML, Qt Lingvist .ts, fișiere JSON go-i18n, Fișiere gotext JSON, Fișier ARB, Fișiere resurse .NET (RESX, RESW)). Many other formats extract closest comment as source string description.
Explicație¶
The Explicație on strings can be stored and parsed from a few file formats.
Currently supported only in Format TermBase eXchange.
Locație șir sursă¶
Localizarea unui șir de caractere în codul sursă ar putea ajuta traducătorii pricepuți să își dea seama cum este utilizat acel șir.
This information is typically available in bilingual formats where strings are extracted from the source code using tools. For example GNU gettext PO (Portable Object) and Qt Lingvist .ts.
Indicarori traducere¶
Translation flags allow customizing Weblate behavior. Some formats support defining those in the translation file (you can always define them in the Weblate interface, see Personalizarea comportamentului cu ajutorul stegulețelor).
This feature is modelled on flags in GNU gettext PO (Portable Object).
Additionally, XML-based formats that support flags extract them from the
non-standard attribute weblate-flags. The max-length:N flag is also
supported through the maxwidth attribute as
defined in the XLIFF standard, see Specificarea indicatoarelor de traducere.
Context¶
Context is used to differentiate identical strings in a bilingual format used in different scopes (for example Sun can be used as an abbreviated name of the day „Sunday” or as the name of our closest star).
For monolingual formats the string identifier (often called key) can serve the same purpose and additional context is not necessary.
Pluralized strings¶
Plurals are necessary to properly localize strings with variable count. The rules depend on a target language and many formats follow CLDR specification for that.
Plural support in the supported features table means Weblate can represent plural strings for the format. Some formats need existing plural metadata or a specific variant, and cannot create new plural strings unless that is natively supported by the format.
Sugestie
Pluralizing strings need proper support from the application framework as well. Choose native format of your platform such as GNU gettext PO (Portable Object), Resurse de șiruri Android or Format Stringsdict.
Multivalue formats¶
Multivalue formats, such as Fișier CSV multivaloare and Format TermBase eXchange, store independent source and target alternatives within one string. These alternatives have no one-to-one pairing, and their counts do not follow grammatical plural rules.
Source checks inspect every source alternative. Target checks compare each target alternative with the source alternatives. A target passes when it matches any source alternative, independently of their order or the languages» grammatical plural forms. The Unchanged translation check instead reports targets identical to any source alternative, subject to its usual exemptions. Automatic fixes are applied only when all source alternatives produce the same correction.
Machine translation suggestions translate each source alternative independently. Automatic machine translation supports strings with one source alternative and at most one target alternative; it skips strings with multiple alternatives to preserve them. Translation service glossaries can use all alternatives. Automatic Memorie de traducere contributions skip strings with multiple alternatives.
LLM translation services use only strings with one source alternative and one target alternative as examples of previous translations. They omit existing translation context for strings with multiple alternatives.
Șiruri numai pentru citire¶
Șirurile de caractere numai pentru citire din fișierele de traducere vor fi incluse, dar nu pot fi editate în Weblate. Această caracteristică este susținută nativ de câteva formate (XLIFF 1.1 and 1.2 și Resurse de șiruri Android), dar poate fi emulată în altele prin adăugarea unui indicator read-only, a se vedea Personalizarea comportamentului cu ajutorul stegulețelor.
Removing obsolete strings¶
Some file formats can store obsolete strings. Weblate can remove these obsolete strings from formats that support this operation.
Sprijinirea altor formate¶
Most formats supported by translate-toolkit which support serializing can be easily supported, but they did not (yet) receive any testing. In most cases, an additional thin layer is needed in Weblate to hide differences in behavior of different storages.
Pentru a adăuga suport pentru un nou format, abordarea preferată este de a implementa mai întâi suportul pentru acesta în translate-toolkit.
Vezi și
File format parameters¶
File format parameters provide a way to configure settings related to the file format. They are configured at component level and allow you to customize how file parsing and serialization are handled.
For supported XML formats, xml_utf8_bom controls the UTF-8 byte order mark:
preserve keeps the input file’s BOM, include always writes it, and
omit removes it. The default is preserve; new files without a template
omit the BOM. Other encodings are unchanged.
The xml_encoding_case parameter selects uppercase or lowercase
encoding names in the XML declaration, such as UTF-8 or utf-8.
The default, default, uses the format’s native casing.
The xml_final_newline parameter controls the newline after the complete XML
document, including any trailing comments or processing instructions. Choose
include for exactly one final line ending, or omit for none.
The default, default, leaves the format’s behavior unchanged. Explicit
inclusion uses the serializer’s line-ending style, falling back to LF when the
output contains no line endings. Translation-content whitespace is unchanged.
List of file format parameters¶
Parameter name |
File formats |
Label |
Help text |
|---|---|---|---|
csv_encoding |
|
File encoding |
Encoding used for CSV files Alegerile disponibile:
|
csv_escape_formulas |
|
Escape spreadsheet formulas |
Prefix values that look like spreadsheet formulas with an apostrophe when saving CSV files. |
csv_simple_encoding |
|
File encoding |
Encoding used for simple CSV files Alegerile disponibile:
|
dos_eol |
All file formats |
Terminții de linie DOS |
Use DOS line endings (rn) instead of UNIX line endings (n) in strings. |
flatxml_key_name |
|
FlatXML key name |
|
flatxml_root_name |
|
FlatXML Root name |
|
flatxml_value_name |
|
FlatXML value name |
|
gwt_encoding |
|
File encoding |
Encoding used for GWT Properties files Alegerile disponibile:
|
json_indent |
|
Indentarea JSON |
|
json_indent_style |
|
Stil indentare JSON |
Alegerile disponibile:
|
json_sort_keys |
|
Sortează chei JSON |
Alegerile disponibile:
|
json_use_compact_separators |
|
Avoid spaces after separators |
|
line_max_length |
|
Maximum line length |
The maximum number of characters for each line in the output file. |
md_extract_code_blocks |
|
Extract code blocks |
Whether to extract translatable content from code blocks in Markdown and MDX files. |
md_extract_frontmatter |
|
Extract front matter |
Whether to extract and translate YAML front matter blocks in Markdown and MDX files. |
md_frontmatter_translate_values |
|
Translate front matter values |
Parse YAML front matter and translate only scalar string values. Keys, structure, comments, and formatting are preserved when possible. |
md_no_placeholders |
|
Disable placeholders |
Disables detection and processing of placeholders in Markdown and MDX files. |
merge_duplicates |
|
Deduplicate identical strings |
Consolidates identical source strings into a single translation unit. Prevents translation loss during file restructuring or table reordering by removing position-dependent context. |
po_contributor_comments |
|
Contributor comments |
Add contributor names and years to header comments. SPDX also converts existing recognized contributor comments to SPDX-FileCopyrightText entries. Alegerile disponibile:
|
po_fuzzy_matching |
|
Folosește potrivire confuză |
|
po_keep_previous |
|
Păstrează msgid-urile anterioare ale șirurilor traduse |
Controls previous msgid comments for fuzzy strings. |
po_line_wrap |
|
Împachetare linii lungi |
By default, gettext wraps lines at 77 characters and at newlines. With the Alegerile disponibile:
|
po_no_location |
|
Do not include location information in the file |
|
po_remove_obsolete |
|
Remove obsolete strings |
Remove obsolete entries from PO files when saving translation changes or updating from a POT file. |
po_report_msgid_bugs_to |
|
Report msgid bugs to |
Lets Weblate update the „Report-Msgid-Bugs-To” file header if Source string bug reporting address is set. |
po_set_language_team |
|
Update language team header |
Lets Weblate update the „Language-Team” file header. |
po_set_last_translator |
|
Update last translator header |
Lets Weblate update the „Last-Translator” file header. |
po_set_x_generator |
|
Update X-Generator header |
Lets Weblate update the „X-Generator” file header. |
properties_encoding |
|
File encoding |
Encoding used for Java Properties files Alegerile disponibile:
|
strings_encoding |
|
File encoding |
Encoding used for iOS strings files Alegerile disponibile:
|
xliff_placeables |
|
Placeables support |
Controls whether inline XML elements inside XLIFF strings are preserved as editable placeables. Plain text only escapes XML markup and treats the content as text. With placeables supported, tags such as <x id=”name”/> or <g> stay in the string and appear as placeholders in the editor Alegerile disponibile:
|
xml_closing_tags |
|
Include etichetă de închidere pentru etichetele XML goale |
|
xml_encoding_case |
|
XML declaration encoding case |
Controls encoding names in the XML declaration, for example „UTF-8” or „utf-8”. Alegerile disponibile:
|
xml_final_newline |
|
XML final newline |
Controls the newline at the end of the file, using the format’s line endings. Alegerile disponibile:
|
xml_utf8_bom |
|
UTF-8 byte order mark |
Controls the UTF-8 byte order mark. Other encodings are unchanged. New files without a template omit the mark when preserving input. Alegerile disponibile:
|
xml_whitespace_handling |
|
Whitespace handling |
Controls how XLIFF whitespace is handled. Follow xml:space honors attributes in the file. Always preserve keeps all whitespace. Always normalize collapses whitespace even when xml:space=”preserve” is set. Alegerile disponibile:
|
yaml_indent |
|
Indentare YAML |
|
yaml_line_break |
|
Linie de pauză |
Alegerile disponibile:
|
yaml_line_wrap |
|
Împachetare linii lungi |
Alegerile disponibile:
|