SEO-Saurus - Real-time development and web experiments
seo-saurus

🦖 Roaring About TYPO3 Translations – How to Make Your Website Speak Dino-Languages

TYPO3 is a mighty beast of a CMS—strong, scalable, and smarter than your average Velociraptor. And what’s even better? It can roar in multiple languages! In this article, we’ll guide you through the fossilized jungle of TYPO3 translations. 🦕🌍

There are two species of translatable content in the TYPO3 ecosystem:

  1. Static Strings – Think of them as fossils buried in code: button labels, footer texts, backend labels.
  2. Database Records – These are the dynamic dinosaurs: content elements, pages, news, etc.

🦴 Translating Static Strings – The XLF Chronicles

To get started, you'll need an XLF file—a fancy XML-based file that holds your language magic. Place it in your extension like so:

EXT:extension_name/Resources/Private/Language/locallang.xlf

Wanna add German? Just prefix it like a dino scientist: de.locallang.xlf

Here’s what your standard locallang.xlf might look like (rawr!):

<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" product-name="extension_name">
<body>
<trans-unit id="page.header">
<source>Header</source>
</trans-unit>
<trans-unit id="page.footer">
<source>Footer</source>
</trans-unit>
</body>
</file>
</xliff>

And now, the German version (aka Dino-Deutsch 🦕🇩🇪):

<xliff version="1.0">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" product-name="extension_name">
<body>
<trans-unit id="page.header">
<source>Header</source>
<target>Kopfzeile</target>
</trans-unit>
<trans-unit id="page.footer">
<source>Footer</source>
<target>Fußzeile</target>
</trans-unit>
</body>
</file>
</xliff>

To use them in your Fluid templates, bring in the mighty f:translate ViewHelper:

<f:translate key="page.header" />
<f:translate key="page.header" extensionName="extension_name" />
<f:translate key="LLL:EXT:extension_name/Resources/Private/Language/locallang.xlf:page.header" />

Want dynamic translations with arguments? Like:

<source>Read more about %s</source>

You'd use:

<f:translate key="page.readmore" arguments="{0: 'Why TYPO3 is a T-Rexcellent CMS'}" />

In PHP:

\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
'page.readmore',
'extension_name',
['Why TYPO3 is a T-Rexcellent CMS']
);

🧠 Backend and Third-Party Translations – Enter: Crowdin the Dino Wrangler

Ever wonder how the core and famous extensions speak so many languages? That’s because they use Crowdin—a translation platform where the whole dino community helps out.

People suggest translations, proofreaders approve them, and TYPO3 sweeps them up in periodic releases.

To fetch the translation packs:

  1. 🦖 Go to Admin Tools → Maintenance → Manage Language Packs
  2. 🦕 Choose your language and click "Download"

🛠️ What If Crowdin Doesn’t Have Your Dino-Dialect?

No worries! That’s why we built the extension hd_translator. It lets you override and edit translations directly in the TYPO3 backend like a translation T-Rex in a china shop.

Other override options include:

TypoScript

plugin.tx_extensionname._LOCAL_LANG.de.page.readmore = Mehr über %s lesen

PHP Override

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:extension_name/Resources/Private/Language/locallang.xlf'][] = '/var/www/html/translations/locallang.xlf';

🧬 Translating Database Records – Multilingual DNA

First, you need to activate your desired languages:

  1. 🌐 Go to Site Management → Sites
  2. Click your site → Languages tab → Add new languages

🦕 Translating Pages and Content

You can't put content on a page that doesn’t exist in the desired language. First step: translate the page!

  1. Open the Page module
  2. Switch to Language Comparison
  3. If a translation is missing, TYPO3 will show “Create a new translation of this page”
  4. Pick the language and save your settings

You can now switch languages using the selector near the top toolbar.

To translate content elements, you can use the Translate button above each language column. This starts a wizard that lets you pick elements to translate.

TYPO3 supports:

  • Free mode – Each language is its own dinosaur
  • Connected mode – One dino, many tongues
  • Mixed mode – Chaos theory confirmed 🦖🌀

🧾 Translating Custom Records in List Module

  • Go to the List module
  • Open your storage folder
  • Make sure the folder itself is translated
    • A) Open one entry and you’ll see flags for available translations or "[NEW]" for new records.
    • B) In the list overview Click on the flag of the available language

💡 Bonus trick: In the language tab of a record, set language to All Languages so it appears regardless of site language.

🦕 FAQasaurus

🦴 My language isn’t working in templates!

Make sure it’s defined:


$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user']['us'] = 'English US';

🦖 What defines the us. or de. prefix?

In your site’s config.yaml, look for:


typo3Language: us

🦕 Can I set a different filename or filepath for my translation files?

Yes-saurus! While TYPO3 suggests storing your XLF fossils in the classic nest at
EXT:extension_name/Resources/Private/Language/, you're not stuck there.

You can use a different filename too—just know that if you wander away from locallang.xlf, you'll need to specify the full path in your templates or PHP code. locallang.xlf is treated as the default alpha file, so TYPO3 sniffs it out automatically. Deviate from that, and you’ll need to guide the beast with something like:

<f:translate key="LLL:EXT:extension_name/Resources/Private/Language/my_custom_file.xlf:page.header" />

So yes—rename, relocate, go wild. Just leave a proper trail of translation breadcrumbs for TYPO3 to follow. 🦴💬

Comments

Comments

Follow me