Laravel-Lang / publisher

Publisher provides functionality for working with application localization
https://laravel-lang.com/packages-publisher.html
MIT License
212 stars 25 forks source link

Attribute name translation not working #312

Closed andrey-helldar closed 2 years ago

andrey-helldar commented 2 years ago

Translation does not work after updating to the latest version and updating transtaions using php artisan lang:update.

Here is a example:

image

After updating transtations the validation.php file looks like:

<?php

return [
    'attributes' => [
        'frontend.email' => 'E-mail',
        'frontend.password' => 'Password',
        //...
    ]
];

Originally posted by @icaliman in https://github.com/Laravel-Lang/publisher/issues/289#issuecomment-1308366995

andrey-helldar commented 2 years ago

@icaliman

I'm leaning towards the fact that this is a feature of Laravel itself because the __() function receives a value for dot translation.

image

  1. https://github.com/laravel/framework/blob/9.x/src/Illuminate/Support/NamespacedItemResolver.php#L33
  2. https://github.com/laravel/framework/blob/9.x/src/Illuminate/Translation/Translator.php#L198

In this case, I can recommend not to use nested attributes.