2017 © Pedro Peláez
 

streams-addon translations-module

image

bitsoflove/translations-module

  • Monday, August 28, 2017
  • by pepijnolivier
  • Repository
  • 6 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

PyroCMS stream-based translation module (alpha)

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)

Installation

  • 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

Configuration

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')
            ),
        ],
    ]
];

Developing

  1. Instead of using composer require, manually add the following entry to the composer 'require' list: "bitsoflove/translations-module": "dev-master"
  2. Add this repository to the composer repositories list (to ensure you'll fetch the repo)
    "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)

Roadmap

~~0.0.1~~, (*9)

  • ~~Reusable proof of concept~~
  • ~~Supports middleware~~
  • ~~Supports file translations (overwrites 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)

  • support laravel fallback and replace options
  • ensure all dist assets are both in the repo and up to date
  • google auto translate
  • view entry (streams)
  • tests

Under consideration, (*12)

  • revisions
  • add default seeder

The Versions

28/08 2017

dev-master

9999999-dev

  Sources   Download

The Requires

 

23/08 2017
16/08 2017
17/07 2017
05/07 2017
05/07 2017

dev-development

dev-development

  Sources   Download

The Requires

 

17/03 2017