定制 dlogon/translation-manager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dlogon/translation-manager

Composer 安装命令:

composer require dlogon/translation-manager

包简介

This is my package translation-manager

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Manage your translations in your laravel proyect with a web interface.

This package has been inspired by barryvdh/laravel-translation-manager

Installation

You can install the package via composer:

composer require dlogon/translation-manager

You can run the migrations and optional publish the migrations with:

php artisan vendor:publish --provider="Dlogon\TranslationManager\TranslationManagerServiceProvider" --tag="migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="Dlogon\TranslationManager\TranslationManagerServiceProvider" --tag="config"

Optionally, you can publish the views using

php artisan vendor:publish --provider="Dlogon\TranslationManager\TranslationManagerServiceProvider" --tag="views"

Usage

To access the web manager, access to the url "yourproject"/translations, if you want to change the route prefix of the manager, publish the config file (translation-manager.php) and change "prefix" inside the "route" array, therefore, if you are not using auth, comment the "auth" middleware inside the route array

 'route' => [
        'prefix' => 'translations',
        'middleware' => [
	        'web',
	        'auth',
		],
    ],

This is that you will see when enter to the manager

When you add a new Lang, you'll see the lang in the bellow section (ADD NEW KEY) and in the table on the bottom

Then, you should add a group in the Groups tab, groups are intended to create diferent files if you work with the "php array" aproach, or for "enhance" the visual presentation if you use the "json" aproach.

Now, you can add a key, with a value for every lang that you have been created. when you press add, you will see the added key in the bottom table, if you do not see the key, ensure that you select the group where you store the key in the above dropdown.

if you want to change any translation, just click the translation and you will see an input to put the new translation, if you click the Ok button, you will see a notifications saying that the translation updated successfully

Model translations

Maybe you noticed the Model translations tab, here, you can generate a group for every model in your app, and this will generate a key for every column in you model.

For example, if we have a Post model, and we already run the migration with some columns.

If you want to avoid some columns, you can add it into the config file, there are a default ignored columns of the User model, and there are a default columns ignored from all models

'ignore_columns' => [
        "id",
        "created_at",
        "updated_at",
        "deleted_at"
    ],
'ignore_model_columns' => [
        "users" => [
            "email_verified_at",
            "remember_token"
        ]
    ],

Generating the translation files

Once you are ready and you have created your translations, is time to create the translations files, above all you will see the big orange button Generate translations, below you will see a radio where you can select the aproach.

If you select the php aproach, your translation files will have the structure

rootapp/<your lang folder>/<lang1>/
                                group1.php
                                group2.php
rootapp/<your lang folder>/<lang2>/
                                group1.php
                                group2.php

If you select the JSON aproach, you will see a property in your generated json, this property has the structure

"//GROUP<group-name>" = "///////////////GROUP-<group-name>/////////////////////"

for example:

en.json

{
    "\/\/GROUPapp": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-app\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "Welcome": "Welcome",
    "\/\/GROUPlanding": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-landing\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "\/\/GROUPPost": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-Post\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "autor_name": "Autor Name",
    "title": "Title",
    "\/\/GROUPUser": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-User\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "email": "",
    "name": "",
}

es.json

{
    "\/\/GROUPapp": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-app\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "Welcome": "Bienvenido",
    "\/\/GROUPlanding": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-landing\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "\/\/GROUPPost": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-Post\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "autor_name": "Nombre del autor",
    "title": "Titulo",
    "\/\/GROUPUser": "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/GROUP-User\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",
    "name": " ",
    "email": " "
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

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

TODO

- Read and store lang files in database
- Filter keys
- Read lang and add to database on install package

dlogon/translation-manager 适用场景与选型建议

dlogon/translation-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「Dlogon」 「translation-manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dlogon/translation-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dlogon/translation-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 dlogon/translation-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-14