Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
Because this is a bug in the twill capsule implementation, to reproduce it it is crucial to create a twill capsule.
Create and register a capsule including a translation
Add a form with a translated field that has a translation in the capsule directory (see following screenshot for an example)
Open the capsules form wherever you may have introduced it
check whether the translation has been applied or not
Expected result
After checking 4.) one should see the translated string, that is defined in the language file, dependened on the set locale.
Actual result
After checking 4.) one sees the language string of the twill capsule.
For example, considering the name of the Capsule was HelloWorld and the translatable string was in a file lang/en/form.php and had the key demo, the displayed string is:
twill:capsule:helloWorld::form.demo.
Description
When adding Twill capsules it is possible to use translations. To make it work Twill uses a callback to register the capsules translation namespace.
However the order of the parameter list is invalid, and the translation is not being applied.
actual
as you can see the addNamespace method is being called with the capsules translation path as first argument, and the namespace as second argument:
Source:
expected (correct)
the addNamespace method should be called with the namespace as first argument, and the capsules translation path as second argument
Steps to reproduce
Because this is a bug in the twill capsule implementation, to reproduce it it is crucial to create a twill capsule.
Expected result
After checking 4.) one should see the translated string, that is defined in the language file, dependened on the set locale.
Actual result
After checking 4.) one sees the language string of the twill capsule. For example, considering the name of the Capsule was
HelloWorld
and the translatable string was in a filelang/en/form.php
and had the keydemo
, the displayed string is:twill:capsule:helloWorld::form.demo
.Versions
Twill version: 3.1.0 Laravel version: 10.43 PHP version: 8.2 || 8.3 Database engine: MySQL