vsch / laravel-translation-manager

Enhanced Management of Laravel 4 & 5 Translations, with Yandex Translation API assisted translations.
MIT License
181 stars 84 forks source link

Translation manager doesn't stores new sentences to database #139

Open protectedfor opened 6 years ago

protectedfor commented 6 years ago

In my view I've added a new translation line, for example {{ trans('header.home') }}. Refreshed the page, but in translation manager this group and key doesn't creates. What I'm doing wrong? It was working perfectly before....

P.S.: Illuminate\Translation\TranslationServiceProvider::class is commented out.

Thanks.

vsch commented 6 years ago

@protectedfor, I will investigate it and see if it is a bug that was introduced in some late fixes.

protectedfor commented 6 years ago

I found what I've missed! I've added this lines to AppServiceProvider

        \Gate::define('ltm-admin-translations', function ($user) {
            return true;
        });

        \Gate::define('ltm-edit-translations', function ($user) {
            return $user;
        });

        \Gate::define('ltm-bypass-lottery', function ($user) {
            return $user;
        });

        \Gate::define('ltm-list-editors', function ($user, $connection_name, &$user_list) {
            return true;
        });
vsch commented 6 years ago

@protectedfor, I would only point out that the way you have defined these functions all users can admin translations, all users can edit translations.

For ltm-bypass-lottery you should return false or just pick out a few users. Since for the users where the result is not false, the lottery is not used to track used translations and used translations will be tracked for all users which may impact performance.

The ltm-list-editors is used by user locale management to get a list of available editors. In your case no users are added to the $user_list so no users will show up in user admin pane.