Skip to content

Commit 937f8e9

Browse files
committed
minor #20797 fix: Change translation domain name for bundle translation and add an example (jbonnier)
This PR was merged into the 6.4 branch. Discussion ---------- fix: Change translation domain name for bundle translation and add an example The documentation was misleading regarding the bundle translations. While the page [Symfony Bundles Documentation](https://symfony.com/doc/current/bundles.html) mentions that translation file names should use PascalCase — as shown in the example `AcmeBlogBundle.en.xlf` — the [Best Practices for Bundles](https://symfony.com/doc/current/bundles/best_practices.html#translation-files) suggest that the translation domain should be `acme_blog`. This inconsistency led me to believe that there might be some mechanism that automatically converts the snake_case domain into PascalCase, but that isn’t the case. I reviewed several bundles by core Symfony developers (such as EasyAdmin and bundles from SymfonyCasts), and they do indeed appear to use PascalCase translation domain names. Commits ------- 20929b4 fix: Change translation domain name for bundle translation and add an example
2 parents 768bdb6 + 20929b4 commit 937f8e9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bundles/best_practices.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,14 @@ Translation Files
397397
-----------------
398398

399399
If a bundle provides message translations, they must be defined in the XLIFF
400-
format; the domain should be named after the bundle name (``acme_blog``).
400+
format; the domain should be named after the bundle name (``AcmeBlog``).
401401

402402
A bundle must not override existing messages from another bundle.
403403

404+
The translation domain must match the translation file names. For example,
405+
if the translation domain is ``AcmeBlog``, the English translation file name
406+
should be ``AcmeBlog.en.xlf``.
407+
404408
Configuration
405409
-------------
406410

0 commit comments

Comments
 (0)