Skip to content

Commit 69c1ae2

Browse files
committed
introduce code-block for xliff
using the XmlLExer
1 parent c99239c commit 69c1ae2

File tree

6 files changed

+35
-33
lines changed

6 files changed

+35
-33
lines changed

_build/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
lexers['varnish3'] = CLexer()
111111
lexers['varnish4'] = CLexer()
112112
lexers['terminal'] = TerminalLexer()
113+
lexers['xliff'] = XMLLexer()
113114

114115
config_block = {
115116
'apache': 'Apache',
@@ -118,7 +119,8 @@
118119
'rst': 'reStructuredText',
119120
'terminal': 'Terminal',
120121
'varnish3': 'Varnish 3',
121-
'varnish4': 'Varnish 4'
122+
'varnish4': 'Varnish 4',
123+
'xliff': 'XLIFF'
122124
}
123125

124126
# use PHP as the primary domain

best_practices/i18n.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Example Translation File
7777
Applying all the previous best practices, the sample translation file for
7878
English in the application would be:
7979

80-
.. code-block:: xml
80+
.. code-block:: xliff
8181
8282
<!-- app/Resources/translations/messages.en.xlf -->
8383
<?xml version="1.0"?>

components/translation/usage.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,7 @@ recommended format. These files are parsed by one of the loader classes.
109109

110110
.. configuration-block::
111111

112-
.. code-block:: yaml
113-
114-
Symfony is great: J'aime Symfony
115-
symfony.great: J'aime Symfony
116-
117-
.. code-block:: xml
112+
.. code-block:: xliff
118113
119114
<?xml version="1.0"?>
120115
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
@@ -132,6 +127,11 @@ recommended format. These files are parsed by one of the loader classes.
132127
</file>
133128
</xliff>
134129
130+
.. code-block:: yaml
131+
132+
Symfony is great: J'aime Symfony
133+
symfony.great: J'aime Symfony
134+
135135
.. code-block:: php
136136
137137
return [
@@ -448,7 +448,7 @@ supports loading and dumping notes is XLIFF version 2.0.
448448
If the XLIFF 2.0 document contains ``<notes>`` nodes, they are automatically
449449
loaded/dumped when using this component inside a Symfony application:
450450

451-
.. code-block:: xml
451+
.. code-block:: xliff
452452
453453
<?xml version="1.0" encoding="utf-8"?>
454454
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0"

translation.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,7 @@ different formats, XLIFF being the recommended format:
126126

127127
.. configuration-block::
128128

129-
.. code-block:: yaml
130-
131-
# messages.fr.yml
132-
Symfony is great: J'aime Symfony
133-
134-
.. code-block:: xml
129+
.. code-block:: xliff
135130
136131
<!-- messages.fr.xlf -->
137132
<?xml version="1.0"?>
@@ -146,6 +141,11 @@ different formats, XLIFF being the recommended format:
146141
</file>
147142
</xliff>
148143
144+
.. code-block:: yaml
145+
146+
# messages.fr.yml
147+
Symfony is great: J'aime Symfony
148+
149149
.. code-block:: php
150150
151151
// messages.fr.php

translation/debug.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@ you've already setup some translations for the ``fr`` locale inside an AcmeDemoB
4949

5050
.. configuration-block::
5151

52-
.. code-block:: yaml
53-
54-
# src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml
55-
Symfony is great: J'aime Symfony
56-
57-
.. code-block:: xml
52+
.. code-block:: xliff
5853
5954
<!-- src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.xliff -->
6055
<?xml version="1.0"?>
@@ -69,6 +64,11 @@ you've already setup some translations for the ``fr`` locale inside an AcmeDemoB
6964
</file>
7065
</xliff>
7166
67+
.. code-block:: yaml
68+
69+
# src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml
70+
Symfony is great: J'aime Symfony
71+
7272
.. code-block:: php
7373
7474
// src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.php
@@ -80,12 +80,7 @@ and for the ``en`` locale:
8080

8181
.. configuration-block::
8282

83-
.. code-block:: yaml
84-
85-
# src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml
86-
Symfony is great: Symfony is great
87-
88-
.. code-block:: xml
83+
.. code-block:: xliff
8984
9085
<!-- src/Acme/AcmeDemoBundle/Resources/translations/messages.en.xliff -->
9186
<?xml version="1.0"?>
@@ -100,6 +95,11 @@ and for the ``en`` locale:
10095
</file>
10196
</xliff>
10297
98+
.. code-block:: yaml
99+
100+
# src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml
101+
Symfony is great: Symfony is great
102+
103103
.. code-block:: php
104104
105105
// src/Acme/AcmeDemoBundle/Resources/translations/messages.en.php

validation/translations.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ Now, create a ``validators`` catalog file in the ``app/Resources/translations``
8888

8989
.. configuration-block::
9090

91-
.. code-block:: yaml
92-
93-
# app/Resources/translations/validators.en.yml
94-
author.name.not_blank: Please enter an author name.
95-
96-
.. code-block:: xml
91+
.. code-block:: xliff
9792
9893
<!-- app/Resources/translations/validators.en.xlf -->
9994
<?xml version="1.0"?>
@@ -108,6 +103,11 @@ Now, create a ``validators`` catalog file in the ``app/Resources/translations``
108103
</file>
109104
</xliff>
110105
106+
.. code-block:: yaml
107+
108+
# app/Resources/translations/validators.en.yml
109+
author.name.not_blank: Please enter an author name.
110+
111111
.. code-block:: php
112112
113113
// app/Resources/translations/validators.en.php

0 commit comments

Comments
 (0)