Laravel-Backpack / theme-tabler

UI for Backpack v6 that uses Tabler and Bootstrap v5.
MIT License
21 stars 12 forks source link

Maybe not ok to do `__('Admin')`? #96

Closed tabacitu closed 12 months ago

tabacitu commented 1 year ago

I've received this by email:

I'm trying a new version and I've run into strange behavior. 3893403B34FC49B6B9413B9C05709A7E The following code inserts appeared in the code: ('Admin') which cause an error: “htmlspecialchars(): Argument #1 ($string) must be of type string, array given” if there is a file admin.php in the translation directory (lang). There is also a code insert : trans(config('backpack.base.authentication_column_name') which is the same as ('Email') and throws an error if there is an email.php file. For a very long time I could not understand what the problem was, since the error itself is not very specific. But it turned out that in the Laravel documentation there is such a paragraph: "Key / File Conflicts. You should not define translation string keys that conflict with other translation filenames. For example, translating ('Action') for the "NL" locale while a nl/action.php file exists but a nl.json file does not exist will result in the translator returning the entire contents of nl/action.php. " Perhaps you would consider using the classic approach (‘backpack::base.admin’) instead of __(‘Admin’)

I think this customer may be right - we should do __(‘backpack::base.admin’) instead of __(‘Admin’) right?

promatik commented 12 months ago

@pxpm pushed this one; https://github.com/Laravel-Backpack/theme-tabler/pull/97/files It was the only place changed on tabler, from core ui 👌

smart4you commented 12 months ago

Screenshot 2023-07-12 174026 Hi, Sorry for writing after the question was closed, but I thought you would look for all cases where the trans('one_word') structure is used and fix them. <label class="form-label" for="{{ $username }}">{{ trans(config('backpack.base.authentication_column_name')) }}</label> - resources/views/vendor/backpack/theme-tabler/auth/login/inc/form.blade.php trans(config('backpack.base.authentication_column_name')) == __('Email') and it will also throw an error if there is an email.php file in the lang folder.

pxpm commented 12 months ago

Opened a separate issue for it #107