定制 hydrarulz/phrase-app-export 二次开发

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

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

hydrarulz/phrase-app-export

Composer 安装命令:

composer require hydrarulz/phrase-app-export

包简介

Command line to export the Phrase App locales

README 文档

README

This Laravel package uses the API that PhraseApp provides to download the Laravel export format.

After you install it just run

php artisan phraseapp:download

And you will see output similar to this

Downloading language id abcdefghijklmnopqrtstuv123456789 for project id abcdefghijklmnopqrtstuv123456789
Done 74833 bytes

Installation

First add the package to your Laravel app

composer require hydrarulz/phrase-app-export

You need to register the service provider. Add this line to your config/app.php providers array

'providers' => [
    // ...
    Hydrarulz\PhraseAppExport\PhraseAppExportProvider::class,
];

Next you need to publish the config file

php artisan vendor:publish --provider="Hydrarulz\PhraseAppExport\PhraseAppExportProvider"

A new file was published in your config directory; now edit the file /config/phrase-app-export.php

return [
    'locales' => [
        'project_id' => '', // Get the project id from Phrase App
        'languages' => [
            'en' => '', // Get the locale id for this language from Phrase App
            'ro' => '', // You can specify multiple languages
        ],
        'format' => 'laravel',
        'file_name' => 'messages.php', // This will create a filename (i.e /resources/lang/en/messages.php)
    ]
];

Get the project_id and language['en'] id from your PhraseApp account. Feel free to add more languages or use only those that you need.

The default language file has 2 languages specified, just add others next to these ones.

After all was set you can just run

php artisan phraseapp:download

Once you have everything setup you can use the trans() function provided by Blade to display the proper translation for the key.

If you get an error like

Client error: `GET https://api.phraseapp.com/api/v2/projects//locales//download` resulted in a `404 Not Found` response

It means you did not change the config file.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-09-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固