https://github.com/fidum/laravel-translation-faker
Generates pseudo Laravel language files from another locale to make it easy to see what still needs translating.
https://github.com/fidum/laravel-translation-faker
laravel laravel-framework localization translation
Last synced: about 1 month ago
JSON representation
Generates pseudo Laravel language files from another locale to make it easy to see what still needs translating.
- Host: GitHub
- URL: https://github.com/fidum/laravel-translation-faker
- Owner: fidum
- License: mit
- Created: 2023-10-27T11:47:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-25T09:29:43.000Z (about 1 year ago)
- Last Synced: 2024-03-25T10:46:53.350Z (about 1 year ago)
- Topics: laravel, laravel-framework, localization, translation
- Language: PHP
- Homepage: https://fidum.uk
- Size: 67.4 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Generates pseudo language files from another locale to make it easy to see what still needs translating.
[](https://packagist.org/packages/fidum/laravel-translation-faker)
[](https://github.com/fidum/laravel-translation-faker/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/fidum/laravel-translation-faker/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://twitter.com/danmasonmp)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.## Installation
You can install the package via composer:
```bash
composer require fidum/laravel-translation-faker
```You can publish the config file with:
```bash
php artisan vendor:publish --tag="translation-faker-config"
```[Click here to see the contents of the config file](config/translation-faker.php).
You should read through the config, which serves as additional documentation and make changes as needed.
## Usage
Just simply run the command with the first argument being the fake locale name you want to use.
```sh
$ php artisan translation:fake --helpUsage:
translation:fake [options] [--]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:
```sh
$ php artisan translation:fake daINFO Translations successfully generated from 'en' to 'da'.
```
By default the locale the command will come from will be from the`translation-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`.```sh
$ php artisan translation:fake da --baseLocale=deINFO 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:
```sh
$ php artisan translation:fake da -vEnsuring 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 DONEINFO Translations successfully generated from 'en' to 'da'.
```
## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Dan Mason](https://github.com/fidum)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.