PHP code example of fidum / laravel-translation-linter

1. Go to this page and download the library: Download fidum/laravel-translation-linter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fidum / laravel-translation-linter example snippets

bash
php artisan vendor:publish --tag="translation-linter-config"
sh
$ php artisan translation:missing

   ERROR  3 missing translations found.  

+--------+--------------------------------+---------------------+
| Locale | Key                            | File                |
+--------+--------------------------------+---------------------+
| en     | Missing PHP Class              | app/ExampleJson.php |
| en     | Only Missing English PHP Class | app/ExampleJson.php |
| de     | Missing PHP Class              | app/ExampleJson.php |
+--------+--------------------------------+---------------------+
sh
$ php artisan translation:missing --generate-baseline 

   INFO  Baseline file written with 49 translation keys.  

$ php artisan translation:missing

   INFO  No missing translations found!  
sh
$ php artisan translation:unused

   ERROR  5 unused translations found.  

+--------+----------------------+-----------------------------------------------+
| Locale | Key                  | Value                                         |
+--------+----------------------+-----------------------------------------------+
| en     | Unused PHP Class     | I am unused in php class                      |
| en     | Unused Blade File    | I am unused in blade                          |
| en     | Unused Vue Component | I am unused in vue component                  |
| en     | example.unused       | I am unused in php class                      |
| de     | example.unused       | Ich werde in einer PHP-Klasse nicht verwendet |
+--------+----------------------+-----------------------------------------------+
sh
$ php artisan translation:unused --generate-baseline 

   INFO  Baseline file written with 5 unused translation keys.  

$ php artisan translation:unused

   INFO  No unused translations found!