tremby / laravel-warning-translator by tremby

A drop-in replacement for the Laravel translator which emits warnings and errors when translations had to fall back or were not found
37
1
3
Package Data
Maintainer Username: tremby
Maintainer Contact: bart@tremby.net (Bart Nagel)
Package Create Date: 2014-10-29
Package Last Update: 2020-06-17
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 03:00:29
Package Statistics
Total Downloads: 37
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 1
Total Watchers: 3
Total Forks: 0
Total Open Issues: 0

Warning translator

This translator is an extension of Laravel 4's built-in one. The only differences are these:

  • A warning (Log::warning) is logged whenever the translation is not found in the current locale and it has to fall back to the fallback locale.
  • An error (Log::error) is logged whenever the translation is not found in any locale.

As an exception, any translation key beginning with validation.custom. will not trigger errors.

These logs will be handled however your log messages are normally logged -- whether appearing in the debug bar, logging to a file or going up to a cloud logging service.

Installation

Require it in your Laravel project:

composer require tremby/laravel-warning-translator

Comment out or delete the line in your app/config/app.php which loads the built in translation service provider:

// 'Illuminate\Translation\TranslationServiceProvider',

Add a new similar line in its place or at the bottom of the providers array:

'Tremby\WarningTranslator\WarningTranslationServiceProvider',

Use

Use translations as normal, as described in the Laravel documentation.