-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b655f65
Showing
12 changed files
with
460 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
preset: laravel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
All notable changes to `LocoLaravelExport` will be documented in this file. | ||
|
||
## Version 1.0 | ||
|
||
### Added | ||
- Everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "mineschan/loco-laravel-export", | ||
"description": "Export strings and translations from https://localise.biz for Laravel 5 projects", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "MineS Chan", | ||
"email": "mineschan@gmail.com", | ||
"homepage": "https://mineschan.com" | ||
} | ||
], | ||
"homepage": "https://github.com/mineschan/locolaravelexport", | ||
"keywords": ["Laravel", "LocoLaravelExport", "i18n", "localise", "loco", "translation", "language"], | ||
"require": { | ||
"illuminate/support": "~5", | ||
"loco/loco": "^2.0", | ||
"chumper/zipper": "1.0.x" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~7.0", | ||
"mockery/mockery": "^1.1", | ||
"orchestra/testbench": "~3.0", | ||
"sempro/phpunit-pretty-print": "^1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"mineschan\\LocoLaravelExport\\": "src/" | ||
}, | ||
"files": [ | ||
"helpers.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"mineschan\\LocoLaravelExport\\Tests\\": "tests" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"mineschan\\LocoLaravelExport\\LocoLaravelExportServiceProvider" | ||
], | ||
"aliases": { | ||
"LocoLaravelExport": "mineschan\\LocoLaravelExport\\Facades\\LocoLaravelExport" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Localise.biz Api Key | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Retrieve Api Key in Your project -> Developer Tools -> Export API -> Export key | ||
| Api key is bind to specific loco project. | ||
*/ | ||
'api_key' => env('LOCO_EXPORT_API_KEY'), | ||
|
||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Language File Name | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Laravel puts language files in resources/lang, this specify the filename | ||
| you would like to save to your project. so you can use __({lang_filename} + $key) or helper loco($key) | ||
| to retrieve your translation. | ||
*/ | ||
'lang_filename' => env('LOCO_EXPORT_FILENAME', 'loco'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Export languages | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Specify locale keys e.g. en, zh_TW, jp here. | ||
| Empty = export all available languages in projects | ||
*/ | ||
'locales' => [], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Export Disk | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Unzipped archive will be saved to this disk. | ||
*/ | ||
'export_disk' => env('LOCO_EXPORT_DISK', 'local'), | ||
|
||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Export Folder | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Default folder that save under desired disk. | ||
*/ | ||
'export_folder' => 'loco_export', | ||
|
||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Clean up downloaded files after export | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Whether or not you want to keep or clean the downloaded files from Loco | ||
*/ | ||
'clean_up' => env('LOCO_EXPORT_CLEAN_UP', true), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
if (!function_exists('loco')) { | ||
/** | ||
* Shortcut to get strings exported from LocoLaravelExport | ||
* | ||
* @param string $key | ||
* @return mixed | ||
*/ | ||
function loco($key) | ||
{ | ||
$filename = config('loco-laravel-export.lang_filename'); | ||
return __($filename . '.' . $key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# The MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Package"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory>src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# LocoLaravelExport | ||
|
||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
[![Build Status][ico-travis]][link-travis] | ||
[![StyleCI][ico-styleci]][link-styleci] | ||
|
||
This is where your description should go. Take a look at [contributing.md](contributing.md) to see a to do list. | ||
|
||
## Installation | ||
|
||
Via Composer | ||
|
||
``` bash | ||
$ composer require mineschan/locolaravelexport | ||
``` | ||
|
||
## Usage | ||
|
||
## Change log | ||
|
||
Please see the [changelog](changelog.md) for more information on what has changed recently. | ||
|
||
## Testing | ||
|
||
``` bash | ||
$ composer test | ||
``` | ||
|
||
## Contributing | ||
|
||
Please see [contributing.md](contributing.md) for details and a todolist. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email mineschan@gmail.com instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [MineS Chan][link-author] | ||
- [All Contributors][link-contributors] | ||
|
||
## License | ||
|
||
MIT. Please see the [license file](license.md) for more information. | ||
|
||
[ico-version]: https://img.shields.io/packagist/v/mineschan/locolaravelexport.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/mineschan/locolaravelexport.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/mineschan/locolaravelexport/master.svg?style=flat-square | ||
[ico-styleci]: https://styleci.io/repos/12345678/shield | ||
|
||
[link-packagist]: https://packagist.org/packages/mineschan/locolaravelexport | ||
[link-downloads]: https://packagist.org/packages/mineschan/locolaravelexport | ||
[link-travis]: https://travis-ci.org/mineschan/locolaravelexport | ||
[link-styleci]: https://styleci.io/repos/12345678 | ||
[link-author]: https://github.com/mineschan | ||
[link-contributors]: ../../contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace mineschan\LocoLaravelExport\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use mineschan\LocoLaravelExport\Facades\LocoLaravelExport; | ||
|
||
/** | ||
* List all locally installed packages. | ||
* | ||
* @author JeroenG | ||
**/ | ||
class Export extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* @var string | ||
*/ | ||
protected $signature = 'localise:export {lang?*} {--force}'; | ||
|
||
/** | ||
* The console command description. | ||
* @var string | ||
*/ | ||
protected $description = 'Export the lang file with Loco Api'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$exportLanguages = $this->argument('lang'); | ||
$force = $this->option('force'); | ||
|
||
if (app()->environment() != 'local' && !$force) { | ||
|
||
$this->alert('Environment is not local!'); | ||
$confirmDownloadAnswer = $this->ask('Proceed downloading lang translations from Localise.biz? [Y/N]'); | ||
|
||
if (strtoupper(trim($confirmDownloadAnswer)) != 'Y') { | ||
$this->comment('Okay, no hard feelings. ;)'); | ||
return; | ||
} | ||
} | ||
|
||
LocoLaravelExport::exportArchive($exportLanguages, $this); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace mineschan\LocoLaravelExport\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class LocoLaravelExport extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return \mineschan\LocoLaravelExport\LocoLaravelExport::class; | ||
} | ||
} |
Oops, something went wrong.