dev-master
9999999-dev
The Requires
dev-development
dev-development
The Requires
Generic translations module for PyroCMS 3.1 and up. This package handles streams translations as well as module translations., (*1)
Heads up!: Currently still in Alpha state. It works, but there are no automated tests yet, and the package is still subject to code review & refactor., (*2)
composer require bitsoflove/translations-module
php artisan module:install translations
navigate to the config/app.php
providers array. Replace Laravel's default TranslationServiceProvider
with the TranslatorServiceProvider
from this package., (*3)
\Bitsoflove\TranslationsModule\Translator\TranslatorServiceProvider::class,
~~Illuminate\Translation\TranslationServiceProvider::class,
~~, (*4)
You might still have to run the build script, (*5)
cd core/bitsoflove/translations-module && npm install && npm run dist
First, you'll have to publish the config file:
- php artisan addon:publish bitsoflove.module.translations
, (*6)
By default, after installing this module, every admin will be able to translate all streams and all modules. To allow only a subset of that list, update the published config file accordingly:, (*7)
<?php return [ 'middleware' => [ // list any middlewares you want to use here // you can use middleware to manipulate this config before the page gets rendered //TranslationsModuleMiddleware::class, ], 'modules' => [ /** * Possible values: * * 'all' or an array of Anomaly\Streams\Platform\Addon\Module classes */ 'allowed' => [ [ 'module' => \Anomaly\PagesModule\PagesModule::class, 'default' => true, ], [ 'module' => \Anomaly\PostsModule\PostsModule::class, 'default' => false, ], ] ], 'streams' => [ /** * Possible values: * * 'all' or an array of EntryModel classes */ 'models' => [ [ 'model' => YourModel::class, 'fields' => ['title'], // just allow translation of the title field 'default' => true, ], [ 'model' => YourSecondModel::class, 'fields' => [], // all fields 'default' => false, ], ], 'locales' => [ 'default' => config('streams::locales.default'), 'supported' => array_keys( config('streams::locales.supported') ), ], ] ];
composer require
, manually add the following entry to the composer 'require' list: "bitsoflove/translations-module": "dev-master"
"repositories": [ { "url": "https://github.com/bitsoflove/pyro_translations-module.git", "type": "git" } ],
Then:
- composer install
- php artisan module:install translations
- cd core/bitsoflove/translations-module
- cp .env.example.js .env.js
- Change the proxy property in .env.js
to the host of your local pyro application
- npm install
- npm run dev
, (*8)
~~0.0.1~~, (*9)
Lang::get()
and trans()
using extended Translator
)~~0.0.2 - code review & refactor - performance updates - add autosave option - ui updates (loader, general styling), (*10)
0.0.3 till 0.1.0, (*11)
fallback
and replace
optionsUnder consideration, (*12)