How to use XLF files in TYPO3 extbase extensions

09. November 2012, Felix Nagel in TYPO3, Extbase & Fluid

  • © TYPO3 Association, typo.org

Adding a localization to an "Extension Builder" generated TYPO3 extbase extension could be a little tricky as it uses the xlf (XLIFF) format.

 

This is a simple way to add new localizations without using extra tools like Virtaal or a Pootle server.

  1. copy file and prefix filename with language coed: example.xlf to de.example.xlf
  2. add target-language="de" attribute to node file
  3. change source nodes to target

 

 

Please make sure...

  • your files are UTF8 encoded
  • to encapsulate special chars in CDATA
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
	<file source-language="en" datatype="plaintext" original="messages" date="2012-06-05T10:52:05Z" product-name="ty_myext">
		<header/>
		<body>
			<trans-unit id="demo_id">
				<source>Dummy text</source>
			</trans-unit>
		</body>
	</file>
</xliff>
Default language xlf file (locallang.xlf)
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
	<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2012-06-05T10:52:05Z" product-name="tx_myext">
		<header/>
		<body>
			<trans-unit id="demo_id">
				<target>Das ist ein Test.</target>
			</trans-unit>
		</body>
	</file>
</xliff>
German language xlf file (de.locallang.xlf)

Die Kommentarfunktion ist für diesen Artikel deaktiviert.

0 Kommentare