PHP code example of kfriars / laravel-translations-manager

1. Go to this page and download the library: Download kfriars/laravel-translations-manager 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/ */

    

kfriars / laravel-translations-manager example snippets


return [

    /*
    |--------------------------------------------------------------------------
    | Laravel Lang Directory
    |--------------------------------------------------------------------------
    |
    | This value is the path to laravels 'lang' folder. This value is used to
    | find your applications translations files using __() and Trans
    |
    */

    'lang_dir' => resource_path('lang'),

    /*
    |--------------------------------------------------------------------------
    | Reference Locales
    |--------------------------------------------------------------------------
    |
    | This is the locale that the development team or a developer works in.
    | This setting assumes all changes to translations files are being made in
    | this locale.
    |
    */

    'reference_locale' => config('app.locale'),

    /*
    |--------------------------------------------------------------------------
    | Supported Locales
    |--------------------------------------------------------------------------
    |
    | These are the locales supported by your application. By default, the
    | Supported locales are all folders listed in the lang directory. You can
    | override the setting if you do not want all locales to be validated using
    | this package.
    |
    */

    // 'supported_locales' => [],

    /*
    |--------------------------------------------------------------------------
    | Fix Files
    |--------------------------------------------------------------------------
    |
    | The fix files are used to fix errors in the translations.
    |
    | 'formatter' is the class that will be used to write and parse the fix files.
    | The default format is a JSON format, since it is easily readable by humans
    | and reliably parseable. You can implement your own formatter as long as it
    | implements the FormatterContract, and use it by changing the setting below.
    |
    | 'fix_name_format' is the way fix files will be named. The currently
    | supported formats are 'git' and 'date'.
    |
    | 'git'  format is 'fixes-{locale}-{git branch name}.txt'
    | 'date' format is 'fixes-{locale}-{Y-m-d}.txt'
    |
    */
    'formatter' => Kfriars\TranslationsManager\TranslationsFixesJSONFormatter::class,
    'fix_name_format' => 'git',
];
 artisan translations:validate locales?* --no-ignore
 artisan translations:errors locales?* --no-ignore
 artisan translations:clean locales?*
 artisan translations:ignore locale file key?
 artisan translations:unignore locale file key?
 artisan translations:generate-fixes locales?*
 artisan translations:fix locales?*
 artisan translations:status locales?*
bash
php artisan vendor:publish --provider="Kfriars\TranslationsManager\TranslationsManagerServiceProvider" --tag="config"
bash
php artisan translations:errors
Shell
There are 9 error(s) in the translations files:

+-------------+-------------------------------+
| de/common                                   |
+-------------+-------------------------------+
| Key         | Message                       |
+-------------+-------------------------------+
| company     | translation_missing           |
+-------------+-------------------------------+


+-------------+-------------------------------+
| de/contact                                  |
+-------------+-------------------------------+
| Key         | Message                       |
+-------------+-------------------------------+
| email       | translation_missing           |
+-------------+-------------------------------+
| straße      | no_reference_translation      |
+-------------+-------------------------------+
| phone       | reference_translation_updated |
+-------------+-------------------------------+

+------------+----------------------+
| de/admin                          |
+------------+----------------------+
| Key        | Message              |
+------------+----------------------+
| FILE_ERROR | file_not_translated  |
+------------+----------------------+

+-------------+-------------------------------+
| en/contact                                  |
+-------------+-------------------------------+
| Key         | Message                       |
+-------------+-------------------------------+
| phone       | reference_translation_updated |
+-------------+-------------------------------+

+------------+----------------------+
| en/admin                          |
+------------+----------------------+
| Key        | Message              |
+------------+----------------------+
| FILE_ERROR | file_not_translated  |
+------------+----------------------+

+-------------+---------------------+
| es/contact                        |
+-------------+---------------------+
| Key         | Message             |
+-------------+---------------------+
| FILE_ERROR  | file_not_translated |
+-------------+---------------------+

+------------+----------------------+
| es/admin                          |
+------------+----------------------+
| Key        | Message              |
+------------+----------------------+
| FILE_ERROR | file_not_translated  |
+------------+----------------------+
bash
php artisan translations:clean de en es
bash
php artisan translations:ignore locale file key?
bash
php artisan translations:ignore de admin
php artisan translations:ignore en admin
php artisan translations:ignore es admin
bash
php artisan translations:generate-fixes de en es
fixes-en-feature-xzy.txt
bash
php artisan translations:fix de en es
bash
php artisan translations:validate

php artisan translations:lock