承接 webard/nova-language-switch 相关项目开发

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

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

webard/nova-language-switch

最新稳定版本:v2.1.0

Composer 安装命令:

composer require webard/nova-language-switch

包简介

A Laravel Nova package to switch language in your application

README 文档

README

Original package: https://github.com/badinansoft/nova-language-switch

This Nova tool lets you:

  • Add a Language switcher to the header of the nova application.
  • Handle Switch language and put the current locale to Laravel session to remember language from multiple browsers.
  • Switch the direction of the application based on the RTL-supported application written in config.
  • Enable or disable showing language name

Requirements

  • php: >=8.0

  • laravel/nova: ^4.0

     Note: This package dose't work with nova 3
    

Features

  • Add multiple languages from the config.
  • Remember set local based on cache no need to save in the database table
  • Auto inject to the header of the application
  • Just 4 steps to setup

Screenshot

|enter image description here |enter image description here |

Installation

You can install the nova tool in to a Laravel app that uses Nova via composer:

composer require webard/nova-language-switch

Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.

// in app/Providers/NovaServiceProvider.php

// ...

public function tools()
{
    return [
        // ...
        new \Badinansoft\LanguageSwitch\LanguageSwitch(),
    ];
}

Next up, must you publish the config file with for add your languages:

php artisan vendor:publish --provider="Badinansoft\LanguageSwitch\ToolServiceProvider" --tag="config"

This is the contents of the published config file:

<?php  
  
return [  
  
	/**  
	 * List of languages that your application supports 
	 * array <string,  string>  
	 */  
	 'supported-languages' => [  
		  'en' => 'English',  
		  'ar' => 'Arabic',  
		  //here you can add new language or remove language that you need by 'local'=>'Label'
	 ],

	/**
     * Display language name in the language switcher
     * bool
    */
    'display-language-name' => true,
  
	/**  
	 * Languages That need RTL support 
	 *  string 
	 */  
	'rtl-languages' => [  
		  'ar'  
		  //here put that language that need support RTL just put local of the language like this example for arabic 
		 
	 ],  
  
];

Finally you should register middleware This is typically done in the $middlewareGroups property of the Http/Kernel in web group.

   /**  
   *  The application's route middleware groups. 
   *  @var array<string, array<int, class-string|string>>  
   */  
   protected $middlewareGroups = [  
     'web' => [  
   		  //...
   		  \Badinansoft\LanguageSwitch\Http\Middleware\LanguageSwitch::class  
     ],
     //...
   ];

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固