承接 trinavo/translation-sync 相关项目开发

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

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

trinavo/translation-sync

Composer 安装命令:

composer require trinavo/translation-sync

包简介

Translation sync package for Laravel applications

README 文档

README

A simple Laravel package to extract translation keys used in your app and sync them into one or more language JSON files (e.g., lang/it.json).

📦 Installation

composer require trinavo/translation-sync --dev

⚙️ Configuration

First, publish the package configuration:

php artisan vendor:publish --tag=translation-sync-config

This will create a config file at:

config/translation-sync.php

In this file, set the path(s) to your translation JSON files:

return [
    'lang_files' => [
        resource_path('lang/it.json'), // laravel < 12
        base_path('lang/ar.json'), // laravel 12+
    ],
];

🚀 Usage

Once you've configured the paths, run the following command:

php artisan translations:sync

This will:

  • Scan your app/ and resources/ directories for any usage of:
    • __('...')
    • trans('...')
    • @lang('...')
  • Collect all found keys.
  • Merge them into the specified language JSON file(s).
  • Preserve existing values and sort them alphabetically.

📁 Example Output

If your app contains:

__('Welcome');
@lang('Logout');

Then lang/ar.json will be updated to include:

{
    "Logout": "",
    "Welcome": ""
}

You can then update the values as needed for translation.

📝 License

This package is open-sourced software licensed under the MIT license.

Made with ❤️ by Feras AbdAlrahman
doonfrs@gmail.com

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-17