gymmed/laravel-package-translator 问题修复 & 功能扩展

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

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

gymmed/laravel-package-translator

最新稳定版本:v0.0.2

Composer 安装命令:

composer create-project gymmed/laravel-package-translator

包简介

Translates laravel package language document using google translate. Works for ecommerce bagisto documents.

README 文档

README

Laravel Package Translator


Laravel Package Translator Logo.

Neat way to translate Laravel package documents with google translate. Highly recommend for Bagisto package development. This package uses stichoza/google-translate-php to translate.

Installation

You can install the package via composer:

composer require gymmed/laravel-package-translator

Usage

To use the command with arguments and options, follow this format:

package-translator:translate {package} {translateFrom} {translateTo} {--comments} {--force}

Explanation of Arguments:

  • {package}: The package path, e.g., Namespace/PackageName
  • {translateFrom}: Language code with source translation file, e.g., en/app
  • {translateTo}: Language code with target translation file, e.g., lt/app
  • {--comments}: (Optional) If you want to include comments.
  • {--force}: (Optional) If you want to force the operation.

usage example:

php artisan package-translator:translate Webkul/Shop en/app lt/app

will translate document from:

rootDirectory/packages/Webkul/Shop/src/Resources/lang/en/app.php

will create translated document in:

rootDirectory/packages/Webkul/Shop/src/Resources/lang/lt/app.php

returned results:

Translation results.

You can translate and leave original text as comments for manual double checking:

php artisan package-translator:translate Webkul/Shop en/app lt/app --comments --force

Use --force option to overwrite document.

returned results:

Translation results with comments.

as code from:

return [
  ...
  'datagrid' => [
      'toolbar' => [
          'length-of' => ':length of',
          'results'   => ':total Results',
          'selected'  => ':total Selected',

          'mass-actions' => [
              'must-select-a-mass-action'        => 'You must select a mass action.',
              'must-select-a-mass-action-option' => 'You must select a mass action\'s option.',
              'no-records-selected'              => 'No records have been selected.',
              'select-action'                    => 'Select Action',
          ],
        ...
];

to:

return [
  ...
  'datagrid' => [
    'toolbar' => [
        'length-of' => ' :length iš', /* :length of */
        'results'   => ' :total Rezultatai', /* :total Results */
        'selected'  => ' :total Pasirinkta', /* :total Selected */

        'mass-actions' => [
            'must-select-a-mass-action'        => 'Turite pasirinkti masinį veiksmą.', /* You must select a mass action. */
            'must-select-a-mass-action-option' => 'Turite pasirinkti masinio veiksmo parinktį.', /* You must select a mass action\'s option. */
            'no-records-selected'              => 'Nepasirinkta jokių įrašų.', /* No records have been selected. */
            'select-action'                    => 'Pasirinkite Veiksmas', /* Select Action */
        ],
        ...
];

If you decide you don't want comments anymore, you can use:

package-translator:uncomment {package} {languageCodeAndFile}

example:

php artisan package-translator:uncomment Webkul/Shop lt/app

returned results:

Translation results with removed comments.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-14