Skip to content

Load the back-office catalogs under the default-twig domain - #27

Merged
ThomasDaSilva merged 1 commit into
thelia-modules:mainfrom
ThomasDaSilva:fix/backoffice-translation-domain
Oct 22, 2026
Merged

ThomasDaSilva merged 1 commit into
thelia-modules:mainfrom
ThomasDaSilva:fix/backoffice-translation-domain

Conversation

@ThomasDaSilva

@ThomasDaSilva ThomasDaSilva commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Since 4.3.0 dropped the Smarty back-office, the module's back-office screens are no longer translated. In a French admin the side menu reads "Credit Notes" instead of "Avoirs", and every other label of the Twig screens falls back to its English source.

The templates translate with the creditnote.bo.default domain. The kernel registers a <module>.bo.<template> domain only for a template directory the module ships, and reads its catalogs from I18n/backOffice/<template>/ (TheliaKernel::loadModuleTranslationDirectories()). The module now ships only templates/backOffice/default-twig/, so the kernel registers creditnote.bo.default-twig, finds no I18n/backOffice/default-twig/, and never loads creditnote.bo.default.

Changes:

  • The back-office catalogs move from I18n/backOffice/default/ to I18n/backOffice/default-twig/, and the templates translate with creditnote.bo.default-twig.
  • TranslationCatalogTest checks that every bo or fo domain names a template directory the module ships, with its catalogs where the kernel reads them. On main it fails with "the creditnote.bo.default domain names a template the module does not ship".
  • Version 4.3.1, CHANGELOG entry.

The domain follows the template the module ships, as TheliaGiftCard already does. Keeping creditnote.bo.default would need an empty templates/backOffice/default/ directory, which the next cleanup would remove. The module domain (creditnote, the one the PHP code uses) would also work, at the cost of mixing the 138 back-office labels into its 23. If you prefer it, I can switch this PR to it.

Upgrade note: a shop that overrides one of these labels in local/I18n with a creditnote.bo.default. key has to rename it to creditnote.bo.default-twig..

Tested: unit suite green (33 tests). In a shop with the module linked, trans('Credit Notes', [], 'creditnote.bo.default-twig', 'fr_FR') returns "Avoirs" through both the framework translator and the Thelia translator, and the old domain still returns "Credit Notes".

@ThomasDaSilva ThomasDaSilva changed the title fix(translations): load the back-office catalogs under the default-twig domain Load the back-office catalogs under the default-twig domain Oct 22, 2026
@ThomasDaSilva
ThomasDaSilva marked this pull request as ready for review October 22, 2026 09:07
@ThomasDaSilva
ThomasDaSilva merged commit 5a9513b into thelia-modules:main Oct 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant