Generates pseudo language files from another locale to make it easy to see what still needs translating.
Having a fake language that reads in your native language can make it easier to keep tracking of what is missing translation as you make changes to your project.
You can install the package via composer:
composer require fidum/laravel-translation-faker
You can publish the config file with:
php artisan vendor:publish --tag="translation-faker-config"
Click here to see the contents of the config file.
You should read through the config, which serves as additional documentation and make changes as needed.
Just simply run the command with the first argument being the fake locale name you want to use.
$ php artisan translation:fake --help
Usage:
translation:fake [options] [--] <locale>
Arguments:
locale The output locale to store faked language files.
Options:
-b, --baseLocale[=BASELOCALE] The base locale to copy language files from.
...
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
If you are going to display this fake language on your system and are planning to also use the locale to control date / currency formats then I recommend that you use a real locale as your fake language.
For example, below our fake language will be generated using the danish da
locale:
$ php artisan translation:fake da
INFO Translations successfully generated from 'en' to 'da'.
By default the locale the command will come from will be from thetranslation-faker.default
value
(which is defaulted to en
).
If you want to use a different base locale when running the command then you can provide it using the
--baseLocale=de
or shorthand --bde
.
$ php artisan translation:fake da --baseLocale=de
INFO Translations successfully generated from 'de' to 'da'.
Note: You must configure your replacer for the custom locale in translation-faker.replacers
config.
You can get more verbose output using the -v
option:
$ php artisan translation:fake da -v
Ensuring directory exists lang/ ......................................................................................................... 0ms DONE
Writing to lang/da.json ................................................................................................................. 0ms DONE
Ensuring directory exists lang/da/ ...................................................................................................... 0ms DONE
Writing to lang/da/example.php .......................................................................................................... 0ms DONE
Ensuring directory exists lang/da/folder/ ............................................................................................... 0ms DONE
Writing to lang/da/folder/example.php ................................................................................................... 0ms DONE
INFO Translations successfully generated from 'en' to 'da'.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.