amdeu/typo3-locallang-formats

Alternative locallang formats

Maintainers

Package info

github.com/amdeu/typo3-locallang-formats

Type:typo3-cms-extension

pkg:composer/amdeu/typo3-locallang-formats

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-03-18 11:22 UTC

This package is auto-updated.

Last update: 2026-03-18 11:30:01 UTC


README

Author your TYPO3 translation labels in YAML, JSON, or PHP arrays instead of XLF.

Requirements

  • TYPO3 13.4 or later

Installation

composer require amdeu/typo3-locallang-formats

No further configuration needed in consuming extensions. Once installed, TYPO3 will pick up .yaml, .json, and .php files in any extension's Resources/Private/Language/ folder.

File format priority

The default priority order is xlf → yaml → json → php. XLF is always checked first so existing extensions are completely unaffected.

To change the priority globally (e.g. to prefer YAML over XLF in your project), change the priority setting in TYPO3_CONF_VARS:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'yaml,xlf,json,php';

YAML

# locallang.yaml
header_comment: The default Header Comment.

login:
  title: Please log in
  submit: Submit
  errors:
    invalid: Invalid credentials

Translation file (de.locallang.yaml):

header_comment: Der Standard-Header-Kommentar.

login:
  title: Bitte einloggen
  submit: Absenden
  errors:
    invalid: Ungültige Anmeldedaten

JSON

{
    "header_comment": "The default Header Comment.",
    "login": {
        "title": "Please log in",
        "submit": "Submit",
        "errors": {
            "invalid": "Invalid credentials"
        }
    }
}

Translation file (de.locallang.json):

{
    "header_comment": "Der Standard-Header-Kommentar.",
    "login": {
        "title": "Bitte einloggen",
        "submit": "Absenden"
    }
}

PHP arrays

<?php
// locallang.php
return [
    'header_comment' => 'The default Header Comment.',
    'login' => [
        'title' => 'Please log in',
        'submit' => 'Submit',
        'errors' => [
            'invalid' => 'Invalid credentials',
        ],
    ],
];

Translation file (de.locallang.php):

<?php
// de.locallang.php
return [
    'header_comment' => 'Der Standard-Header-Kommentar.',
    'login' => [
        'title' => 'Bitte einloggen',
        'submit' => 'Absenden',
    ],
];

Multi-language files

All formats follow the same naming convention as XLF:

Resources/Private/Language/
    locallang.yaml          ← default language (English)
    de.locallang.yaml       ← German
    fr.locallang.yaml       ← French
    locallang_be.yaml       ← additional files work the same way

Usage in templates and PHP

Identical to XLF — just use the file's actual extension in the path:

<f:translate key="LLL:EXT:my_ext/Resources/Private/Language/locallang.yaml:login.title" />
LocalizationUtility::translate(
    'LLL:EXT:my_ext/Resources/Private/Language/locallang.yaml:login.title',
    'MyExt'
);