承接 blendbyte/laravel-crowdin-sync 相关项目开发

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

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

blendbyte/laravel-crowdin-sync

最新稳定版本:v2.0.7

Composer 安装命令:

composer require blendbyte/laravel-crowdin-sync

包简介

Syncs Translation Data from Laravel to a Crowdin project and back.

README 文档

README

  • Automatically syncs your translations files as source to Crowdin and also syncs back translations from Crowdin into your files
  • Can sync custom translatable content (using spatie/laravel-translatable fields) to Crowdin and back into your database
  • Can run as part of a scheduled command to ensure always up2date translations in your database

Installation

You can install the package via composer:

composer require blendbyte/laravel-crowdin-sync

You can publish the config file with:

php artisan vendor:publish --tag="crowdin-sync-config"

These are the contents of the published default config file:

return [
    // Debug Output to STDOUT
    'debug' => env('CROWDIN_DEBUG', false),

    // Crowdin Access Token for the API
    'api_key' => env('CROWDIN_API_KEY'),


    // Project ID for Translation Files (must be "File-based project")
    'project_id_files' => env('CROWDIN_PROJECT_ID_FILES', -1),

    // File Update Option, choose one of clear_translations_and_approvals, keep_translations, keep_translations_and_approvals
    'file_update_options' => env('CROWDIN_FILE_UPDATE_OPTIONS', 'clear_translations_and_approvals'),

    // Only export approved translations for translation files
    'file_export_approved_only' => env('CROWDIN_FILE_EXPORT_APPROVED_ONLY', true),


    // Project ID for Content Translations (must be "String-based project")
    'project_id_content' => env('CROWDIN_PROJECT_ID_CONTENT', -1),

    // Content branch ID
    'content_branch_id' => env('CROWDIN_CONTENT_BRANCH_ID', -1),

    // Only apply approved translations to content translations
    'content_approved_only' => env('CROWDIN_CONTENT_APPROVED_ONLY', false),
];

Usage

LaravelCrowdinSync::make()->syncFiles(source_path: 'lang/', crowdin_path: 'laravel/');
LaravelCrowdinSync::make()->uploadFiles(source_path: 'lang/', crowdin_path: 'laravel/');
LaravelCrowdinSync::make()->downloadFiles(source_path: 'lang/', crowdin_path: 'laravel/');

# refactoring this:
# LaravelCrowdinSync::make()->syncContent(\App\Models\Page::class);
# LaravelCrowdinSync::make()->uploadContent(\App\Models\Page::class);
# LaravelCrowdinSync::make()->downloadContent(\App\Models\Page::class);

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-14