hydrarulz/phrase-app-export

Command line to export the Phrase App locales
1,816 1
Install
composer require hydrarulz/phrase-app-export
Latest Version:v0.4
Last Updated:Oct 12, 2016
Links: GitHub  ·  Packagist
Maintainer: hydrarulz

An easy way to download PhraseApp language files for Laravel

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.

Related Packages

highsolutions/laravel-lang-import-export

A Laravel package providing artisan commands to import and export language files...

339,763 24
ufirst/lang-import-export

A Laravel package providing artisan commands to import and export language files...

236,086 41
cyber-duck/laravel-excel

This package provides a way to export an Eloquent collection as an excel file an...

232,615 74
maatwebsite/excel

Supercharged Excel exports and imports in Laravel

169,501,170 12,703
torann/localization-helpers

An artisan command package for easy translation management.

8,152 8