ibrhaim13/translate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ibrhaim13/translate

Composer 安装命令:

composer require ibrhaim13/translate

包简介

laravel static text translate package for laravel 7 up

README 文档

README

ibrhaim13/mdb-translate is laravel translation package using mongodb for static text that is simple,dynamic and enjoyable to use.

Official Documentation

Install (Laravel ^10.0)

Install via composer

composer require ibrhaim13/translate

Publish Package

will publish Package Components translate13 (config file), Migration file, view,

php artisan vendor:publish --force --tag=translate13

Dependents:

you should install laravel on of Starter Kits auth package like auth/ui or laravel-breeze or other cause should this feature for admins. we are also Dependent to laravel view app layout if you want to make your custom view you do not need it at all.

Basic Configure Package

Run migrate

php artisan migrate

add middleware for web middleware group for add local to url path

# app/Http/Kernel.php

protected $middlewareGroups = [
        'web' => [
        ...,
        Ibrhaim13\Translate\Http\Middleware\Web\Localization::class,
        ...
        ]

will change local of app once change it at url.

add prefix to routes via Route Service Provider of application

# app/Providers/RouteServiceProvider.php
# boot function inside route callback funcation add ->prefix(Localization::routePrefix())
      Route::middleware('web')->prefix(Localization::routePrefix())
           ->group(base_path('routes/web.php'));

Advance Configure Package

you can be custom route ,prefix,add new language and add your middlewares as you like view, and you should add translate page route into your navbar of app, so you can access page you can add new translate group via extend the model and overwrite the group

# app/Models/YourTranslateModelExtendFromPackageModel.php
    public static array $groups = [
        'str_public',
        'str_admin',
        //here add your new group as you like
    ];

How you can use

after set up your configuration you can access translate page to add new keys so you can translate it from admin panel

#first segment is a group name
#secand segment is translated key
__('str_public.key name');

by default there two group name str_public,str_admin,after add the key before open translate admin page you must open the page there have this key so laravel application loaded

to access translate admin panel page

http://yourdomain.com/en/translate

then click on generate button to generate static translate files after edit your translation ##NOTE: YOUR SERVER NEED PERMISSION TO CRAETE TRANSLATIONS FILES

Security Vulnerabilities

e-mail us at i.musabah92@gmail.com

License

ibrhaim13/translate is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固