Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
t
andtrans
filters 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
tc
function - Adds the
TrancTranslationManager::CONTENT_LANGCODE
constant, usable in anyt
/format_plural
/new TranslatableMarkup
/string_translation
service calls. - Adds new twig filters:
tc
/transc
translates to the content language in any theme,ti
/transi
translates 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.
Supporting organizations:
Project information
- Seeking co-maintainer(s)
Maintainers are looking for help reviewing issues. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Multilingual
- 11 sites report using this module
- Created by Ghost of Drupal Past on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.