This package provides Persian language files for Laravel.
- Support Laravel 6 to 12
You can install the package via composer:
composer require sadegh19b/laravel-persian-lang
If you prefer not to use Composer, you can manually copy the language files:
- Download or clone this repository
- Copy the
fa
folder fromlang/
to your Laravel application'slang/
directory - The language files will be available in your application
After installing the package, the Persian language files are automatically available without any additional configuration.
Simply set the locale to fa
in your config/app.php
file:
'locale' => 'fa',
Or set it dynamically in your code:
app()->setLocale('fa');
That's it! Now you can use Laravel's translation functions normally:
__('validation.required') // فیلد الزامی است
__('auth.failed') // اطلاعات ورود نادرست است
__('passwords.reset') // رمز عبور بازنشانی شد
trans('pagination.previous') // قبلی
No need to publish or use any namespace! The package works automatically when your locale is set to fa
.
If you want to customize the translations, you can optionally publish them:
php artisan vendor:publish --tag=persian-lang
This will copy the language files to lang/fa/
in your application. Your published files will automatically take precedence over the package files.
If you want to change validation attributes, just copy the validation-attributes.php
file to your lang/fa/
directory and don't need to publish other translation files.
auth.php
- Authentication related translationspasswords.php
- Password reset related translationsvalidation.php
- Validation related translationsvalidation-attributes.php
- Validation attributes related translations (added by me)pagination.php
- Pagination related translations
Please feel free to submit any issues or pull requests.
The MIT License (MIT). Please see License File for more information.