承接 j-hansol/laravel-language-detect 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

j-hansol/laravel-language-detect

最新稳定版本:v1.0.0

Composer 安装命令:

composer require j-hansol/laravel-language-detect

包简介

This is a package for language detection and configuration for Laravel.

README 文档

README

License License

It provides a very simple function for detecting and setting the language in a website or backend service running on the Laravel framework.

installation

You can simply install it with the command below from the project path under development.

composer require j-hansol/laravel-language-detect

Add the following content to the .env file. If not added, it will be set to the contents of the language_detect.php file included in the package.

APP_LOCALES="ko,en"
APP_LOCALE_SEGMENT=1
APP_LOCALE_FIELD_NAME=language

How to use

To detect and set the language, simply add middleware to the routing path as shown below.

Route::prefix('{locale}')->group(function() {
    Route::get('test', [\App\Http\Controllers\LanguageSettingTest::class, 'showResult'])
        ->middleware('set_language');
});

Customize your preferences file

If you have made the necessary settings in .env, this step will not be necessary. Nevertheless, if you want to change the settings, you can change the contents after executing the command below.

php artisan vendor:publish --tag=language-detect

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-10