mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-23 03:56:23 +00:00
50 lines
1.2 KiB
Markdown
50 lines
1.2 KiB
Markdown
|
---
|
||
|
id: 36596d9f-7a8e-4018-a28c-e6ed2f727c47
|
||
|
title: XLIFF 2.0
|
||
|
---
|
||
|
|
||
|
# Introduction
|
||
|
|
||
|
From [Symfony 4.0](20201109140137-symfony_4_0) XLIFF support has been
|
||
|
added.
|
||
|
|
||
|
# Syntax
|
||
|
|
||
|
``` xml
|
||
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0"
|
||
|
srcLang="fr-FR" trgLang="en-US">
|
||
|
<file id="messages.en_US">
|
||
|
<unit id="LCa0a2j">
|
||
|
<notes>
|
||
|
<note category="state">new</note>
|
||
|
<note category="approved">true</note>
|
||
|
<note category="section" priority="1">user login</note>
|
||
|
</notes>
|
||
|
<segment>
|
||
|
<source>original-content</source>
|
||
|
<target>translated-content</target>
|
||
|
</segment>
|
||
|
</unit>
|
||
|
</file>
|
||
|
</xliff>
|
||
|
```
|
||
|
|
||
|
``` php
|
||
|
$catalogue = new MessageCatalogue('en_US');
|
||
|
$catalogue->add([
|
||
|
'original-content' => 'translated-content',
|
||
|
]);
|
||
|
$catalogue->setMetadata('original-content', ['notes' => [
|
||
|
['category' => 'state', 'content' => 'new'],
|
||
|
['category' => 'approved', 'content' => 'true'],
|
||
|
['category' => 'section', 'content' => 'user login', 'priority' => '1'],
|
||
|
]]);
|
||
|
|
||
|
$dumper = new XliffFileDumper();
|
||
|
$dumper->formatCatalogue($catalogue, 'messages', [
|
||
|
'default_locale' => 'fr_FR',
|
||
|
'xliff_version' => '2.0'
|
||
|
]);
|
||
|
```
|