Search by

b13 / language-limits

bmack

Limit in which languages pages and content elements are shown, per record and per language, on top of the fallback chain of the site configuration.

Package info

github.com/b13/language-limits

Type:typo3-cms-extension

pkg:composer/b13/language-limits

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-11-06 06:30 UTC

This package is auto-updated.

Last update: 2026-11-26 15:18:17 UTC


README

CI

EXT:language_limits - A TYPO3 Extension for limiting records to languages

Introduction

In TYPO3, the site configuration decides for a whole language how translations are handled:

  • fallbackType: strict shows only translated content elements,
  • fallbackType: fallback also shows untranslated content elements in the default language,
  • fallbacks (the fallback chain) decides in which languages a translation is looked for, and whether a page without translation is shown in the default language (0 in the chain) or results in "page not found".

Real projects need exceptions for single records: a legal notice that must not be shown in one market, a teaser that should appear in English until it is translated, a page tree that only exists in some languages.

This extension adds these exceptions, per record and per language, without changing the site configuration. Without a limit, the site configuration decides as before.

Installation & Requirements

Install the extension via composer:

composer req b13/language-limits

The extension requires TYPO3 v14.3 or TYPO3 v15, and PHP 8.2 or higher (PHP 8.5 for TYPO3 v15).

Features

  • Limit pages and content elements to languages, per record and per language
  • Limits for pages can also apply to all subpages
  • Pages that are limited result in "page not found", are removed from menus, and links to them are rendered as text
  • Content elements that are limited are removed from the output, or are shown in the default language if they are not translated
  • Works for records of other tables that are translated in connected mode
  • Applies wherever TYPO3 overlays records with translations via PageRepository (for example CONTENT, RECORDS and Extbase repositories), and to menus and page links generated by TYPO3

Limits

Every page and content element in the default language gets the field "Language limits", with one row per language of its site:

Limit Shown in the language …
No limit as decided by the site configuration
Only if translated only if a translation into this language exists
If translated, or available in a fallback language if a translation into this language or into a language of the fallback chain exists; the default language counts only if 0 is in the fallback chain
Never never, even if a translation exists
Always (content elements only) always: the translation if one exists, otherwise the default language record

Limits only exist for languages other than the default language. They are stored in the default language record and copied to its translations.

Limits for subpages

For pages, a limit can also apply to all subpages ("Also for subpages"). A subpage uses its own limit for a language first, then the limit of the closest ancestor page that applies to subpages.

Adding limits to other tables

The field is added to pages and tt_content. To use limits for records of another table, add the column with the same configuration:

// Configuration/TCA/Overrides/tx_news_domain_model_news.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_news_domain_model_news', [
    'tx_languagelimits' => [
        'exclude' => true,
        'label' => 'language_limits.db:field.label',
        'displayCond' => 'FIELD:sys_language_uid:=:0',
        'l10n_mode' => 'exclude',
        'config' => [
            'type' => 'json',
            'renderType' => 'languageLimits',
        ],
    ],
]);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_news_domain_model_news', 'tx_languagelimits');

Technical Details

The field tx_languagelimits (TCA type json) stores the limits keyed by language id. Invalid entries are removed when a record is saved.

{"1": {"mode": "never", "subpages": true}, "2": {"mode": "translated"}}

Limits are applied by PSR-14 event listeners:

Area Event
Requested page: "page not found" AfterPageAndLanguageIsResolvedEvent
Menus: limited pages are removed FilterMenuItemsEvent
Page links: rendered as text ModifyPageLinkConfigurationEvent, AfterLinkIsGeneratedEvent
Records overlaid by PageRepository: removed, or shown in the default language AfterRecordLanguageOverlayEvent

Relation to TYPO3 Core

TYPO3 Core is moving towards one language mode that is driven by the fallback chain: the overlay type LanguageAspect::OVERLAYS_ON is deprecated (#111326), and Extbase returns records without default language record in fallback mode as TypoScript does (#111329). TYPO3 Core provides the behavior for a whole language, this extension adds exceptions for single records.

Open Issues

  • Lists with a limit. Records are removed after they have been fetched from the database. A LIMIT in a query (CONTENT with select.max, Extbase setLimit(), pagination) and Extbase's count() include records that are removed afterwards. TYPO3 has the same restriction for its own overlays. An event to modify the language constraint of CONTENT queries in TYPO3 Core would allow applying limits in SQL.
  • "Always" with Extbase and fallbackType: strict. Extbase only fetches translated records in this case, so untranslated records cannot be added.
  • "Always" for pages. Whether an untranslated page is shown in the default language is decided by the fallback chain of the site language (0 in fallbacks).
  • fallbackType: free. Records are fetched in the requested language directly and are not overlaid, so content element limits do not apply.
  • Not covered yet: XML sitemaps of EXT:seo, indexed_search.

If you find an issue, feel free to create an issue on GitHub or a pull request.

Extension Tests and Coding Guidelines

You can run our test suite for this extension yourself, the same way GitHub Actions does, in containers (docker or podman):

  • run Build/Scripts/runTests.sh -t 14 -s composerInstall (or -p 8.5 -t 15 for TYPO3 v15)
  • run Build/Scripts/runTests.sh -s unit
  • run Build/Scripts/runTests.sh -s functional (add -d sqlite for SQLite)

To assure coding guidelines are fulfilled:

  • run Build/Scripts/runTests.sh -s lint
  • run Build/Scripts/runTests.sh -s cgl -n
  • run Build/Scripts/runTests.sh -t 14 -s phpstan

Build/Scripts/runTests.sh -h lists all options.

License

The extension is licensed under GPL v2+, same as the TYPO3 Core. For details see the LICENSE file in this repository.

Credits

This extension was created by Benni Mack in 2026 for b13 GmbH. It is based on the concept of the extension languagevisibility by AOE GmbH, without taking over its code.

Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.