larswiegers / laravel-translations-checker
Make sure your laravel translations are checked and are included in all languages.
Installs: 162 123
Dependents: 1
Suggesters: 1
Security: 0
Stars: 231
Watchers: 2
Forks: 16
Open Issues: 5
Requires
- php: ^7.4|^8.0|^8.1|^8.2
- ext-json: *
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^9.0|^10.0|^11.0
- dev-main
- v0.9.2
- v0.9.1
- v0.9
- v0.8
- v0.7
- v0.6
- v0.5
- v0.4
- v0.3
- v0.2
- v0.1
- dev-feature/exclude-certain-file-extensions
- dev-refactorv2
- dev-laravel-11
- dev-laravel11
- dev-exclude-ds-store
- dev-refactor
- dev-excluding-keys
- dev-json-files-instead-of-dirs
- dev-laravel-10-testing
- dev-laravel-10
- dev-php-8.2
- dev-unsed-command
- dev-readme-updates
- dev-fix_deeper_directories_bug
- dev-support-json
- dev-add-in-command
This package is auto-updated.
Last update: 2024-11-04 16:27:39 UTC
README
Ever feel that you are missing translations in some languages you support? Get users emailing you about weird strings on their screen?
Use the laravel translation checker and get direct feedback where and what translations you are missing!
Installation
You can install the package via composer:
composer require larswiegers/laravel-translations-checker
Usage
Use the command below, it is that easy!
php artisan translations:check
Different directory
Are your translations in a weird directory? use the --directory option like this:
php artisan translations:check --directory=resources/lang
Exclude directories
Some packages have their own language files, it is probably smart to exclude them.
php artisan translations:check --excludedDirectories=lang/vendor
This option is also available as configuration option 'excluded_directories'.
For example:
'excluded_directories' => ['lang/vendor'],
Exclude languages
This section provides instructions on how to exclude specific languages from being checked.
To exclude languages, follow these steps:
-
Open the project's configuration file.
-
Locate the
translation-checker
file. -
Add the language codes of the languages you want to exclude to the
exclude_languages
field.
For example:
exclude_languages = ["en", "fr", "es"]
Exclude file types
- Let's say you only want to run on the php or json files in your project than you can use the --excludedFileExtensions option like this:
php artisan translations:check --excludedFileExtensions=php
This option is also available as configuration option 'excluded_file_extensions'.
JSON support
The package supports both .php files and .json files for the translations.
Running in github actions?
translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: php-cs-fixer, phpunit
- name: Install Dependencies
run: composer install -q --no-interaction --no-scripts
- name: Run translations check
run: php artisan translations:check --excludedDirectories=vendor
What does the output look like?
The language nl (resources/lang/nl) is missing the file ( passwords.php )
Missing the translation with key: nl.passwords.reset
Missing the translation with key: nl.passwords.sent
Missing the translation with key: nl.passwords.throttled
Missing the translation with key: nl.passwords.token
Missing the translation with key: nl.passwords.user
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email larswiegers@live.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.