Laravel localization
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Requirements
- PHP ,
- Laravel 6, 7, 8 latest version,
- Redis or TaggableStore driver for cache.
Installation
You can install the package via composer:
composer require yusufonur/laravel-localization
You can publish and run the migrations with:
php artisan vendor:publish --provider="YusufOnur\LaravelLocalization\LaravelLocalizationServiceProvider" --tag="migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="YusufOnur\LaravelLocalization\LaravelLocalizationServiceProvider" --tag="config"
Usage
$turkish = LaravelLocalization::createLanguage("Türkçe", "tr");
$english = LaravelLocalization::createLanguage("İngilizce", "en");
$metaHome = LaravelLocalization::createLanguageMeta("home");
$metaContact = LaravelLocalization::createLanguageMeta("Contact");
LaravelLocalization::createLanguageMetaTranslate($turkish, $metaHome, "Anasayfa");
LaravelLocalization::createLanguageMetaTranslate($turkish, $metaContact, "İletişim");
LaravelLocalization::createLanguageMetaTranslate($english, $metaHome, "Home");
LaravelLocalization::createLanguageMetaTranslate($english, $metaContact, "Contact");
return LaravelLocalization::getLanguageMetaTranslatesRegular();
/*
{
"en": {
"home": "Home",
"Contact": "Contact"
},
"tr": {
"home": "Anasayfa",
"Contact": "İletişim"
}
}
*/
Helper Usage
{{ __local("home") }}
If default language (you can get with app()->getLocale()) then result is tr: "Anasayfa"
If getLocale then result is en: "Home"
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.