Translate to content language
Security covered
Synopsis
When the content and the interface languages are different, Drupal core doesn't provide a way to translate fixed strings to the content language. To help modules and templates both, this module:
- automatically changes the
tandtransfilters and the% trans %tag in the templates under the default theme directory to use the content language as default instead of the interface language. - Adds the
tcfunction - Adds the
TrancTranslationManager::CONTENT_LANGCODEconstant, usable in anyt/format_plural/new TranslatableMarkup/string_translationservice calls. - Adds new twig filters:
tc/transctranslates to the content language in any theme,ti/transitranslates to the interface language in any theme.
Also, config objects -- webforms, views -- do not work properly in this scenario. The tranc_config submodule is provided for this purpose.
Known problems
- There is no way to force the
% trans %tag to translate to the interface language in the default theme as it is unlikely the shorter strings of interface would require this tag. - In a template not under the default theme, translating to the content language with the
% trans %tag requires the constant() Twig function. This has not been tested.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.