Search by

adbros / translation-extra

martenb

Extracting translation contents and updating catalogues automatically for Nette FW.

Package info

github.com/adbrosaci/translation-extra

pkg:composer/adbros/translation-extra

Statistics

Installs: 7 816

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.2 2026-10-13 10:11 UTC

This package is auto-updated.

Last update: 2026-10-13 10:48:39 UTC


README

Extracting translation contents and updating catalogues automatically for Nette FW.

Inspired by kdyby/translation package.

Requirements

Requires symfony/console, you may use contributte/console.

Instalation

composer require adbros/translation-extra

Register extension

extensions:
	translationExtra: Adbros\TranslationExtra\DI\TranslationExtraExtension

Default configuration

translationExtra:
	extractor:
		defaultScanDir:
			- %appDir%
		defaultOutputDir: %appDir%/locale
		defaultFormat: neon
		extractors:
			nette: Adbros\TranslationExtra\Extractor\NetteExtractor 
			latte: Adbros\TranslationExtra\Extractor\LatteExtractor
		loaders:
			neon: Adbros\TranslationExtra\Loader\NeonFileLoader
		dumpers:
			neon: Adbros\TranslationExtra\Dumper\NeonFileDumper 

Usage

bin/console translation:extract cs

Latte templates

LatteExtractor walks the whole template and collects every {_'message'} (and any print with the translate filter) whose message is a string literal, including HTML attribute values, n: attributes, all {if}/{elseif}/{else} branches, loops and nested blocks. Dynamic messages like {_$message} are skipped.

A template that cannot be parsed does not stop the extraction. It is skipped and reported as a warning, so its messages are missing from the extracted catalogue. When any template is skipped, --clean is not applied: the extracted messages are only merged into the translation files and a warning says that cleaning was skipped, so no existing messages are removed. Fix the reported templates and run the command again to clean the files.