motia / laravel-translations-port
Import/Export your laravel translations(including the missing ones!) to/from your separate frontend apps.
0.2.0
2019-05-14 01:18 UTC
Requires (Dev)
- symfony/yaml: ^4.0
- vsch/laravel-translation-manager: ^2.6
Suggests
- vsch/laravel-translation-manager: Required to the translation manager UI and use VschTranslationsLoader
This package is auto-updated.
Last update: 2025-04-05 00:46:24 UTC
README
This package comes with a translation manager laravel-translation-manager and gives it the ability to import/export and a translation group to json
or yaml
.
Setup
- Install the package.
composer require motia/laravel-translations-port
- (optional if
autodiscovery
is on) Add the service providerMotia\TranslationsPort\TranslationsPortProvider
- Publish the config file using the command
php artisan vendor:publish --provider="Motia\TranslationsPort\TranslationsPortProvider"
- Setup and configure vsch/laravel-translation-manager
- (optional) if you want to use
yaml
format runcomposer install "symfony/yaml" "^4.0"
Usage
- Import translations from file to database
php artisan trans:import
- Export translations from database to file
php artisan trans:import
- Missing translations This package comes with a controller to add missing translations and a helper function to add it to your routes.
// routes/api.php <?php use Motia\TranslationsPort\Controller as TranslationsPortController; TranslationsPortController::routes([ 'prefix' => 'translations-port', 'middleware' => 'cors', ]);
// on your client app axios.post('/missing', { key: 'namespaced.key', locale: 'en', group: 'client_app' // optional, defaults config('translations-port.groups')[0]. })