GithubHelp home page GithubHelp logo

eboye / laravel-nova-translation-editor Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 5.0 129 KB

Laravel Nova Translation Editor

License: MIT License

PHP 45.90% Vue 45.26% JavaScript 3.40% CSS 0.15% HTML 5.29%
laravel nova php vuejs2 vue2 translation-management laravel-5-package laravel-nova-tool

laravel-nova-translation-editor's Introduction

Laravel Nova Translation Editor

This is the Laravel Nova Tool for managing translations. It's still work in progress.

You can view all the translations. Clicking on string you can edit it and save. The mutlilevel arrays in lang files are currently not working. So if you have idea on how to solve it. Please make a pull request.

It depends on spatie/laravel-translation-loader

So first you need to install it and set it up. Then add this Tool.

Installation

composer require eboye/laravel-nova-translation-editor

If you haven't already done, do publish Spatie/laravel-translation-loader migrations

php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider"
php artisan migrate

Usage

Publish Config

Publish config file and add any of the files you have in resource/lang/ folder

php artisan vendor:publish --provider="Eboye\LaravelNovaTranslationEditor\ToolServiceProvider"

config/trans_editor.php looks like this:

<?php
return [
    'auth'
];

Just add any of the lang files you need.

Add Nova tool

In your App\Providers\NovaServiceProvider.php, under tools, add

new LaravelNovaTranslationEditor

and also the import of the Class

use Eboye\LaravelNovaTranslationEditor\LaravelNovaTranslationEditor;

Screenshots

screenshot 1

laravel-nova-translation-editor's People

Contributors

eboye avatar olivm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-nova-translation-editor's Issues

Problem when add in NovaServiceProvider

Hi, when I add LaravelNovaTranslationEditor in NovaServiceProvider I get this error
"TypeError
Return value of DigitalCreative\CollapsibleResourceManager\Resources\TopLevelResource::parseResource() must be an instance of DigitalCreative\CollapsibleResourceManager\Resources\AbstractResource or null, instance of Eboye\LaravelNovaTranslationEditor\LaravelNovaTranslationEditor returned (View: D:\Eurocoders\hosting\nova\resources\views\layout.blade.php)"
My code is this:
public function tools()
{
$resources = [];

  .....
    $resources[] = Group::make([
        'label' => 'System',
        'resources' => [
            \App\Nova\Plan::class,
            \App\Nova\PaymentMethod::class,
            \App\Nova\Coupon::class
        ]
    ]);

    $resources[] = Group::make([
        'label' => 'Articles',
        'resources' => [
            \App\Nova\Article::class,
            \App\Nova\ArticleCategory::class
        ]
    ]);

    $resources[] = Group::make([
        'label' => 'Pages',
        'resources' => [
            \App\Nova\Page::class,
            \App\Nova\Faq::class,
            \App\Nova\Review::class
        ]
        
    ]);
    $resources[] = Group::make([
        'label' => 'Translations',
        'resources' => [
             new LaravelNovaTranslationEditor
            ]
                
        ]);
    # Define variable to hold the available custom tools
    $customTools = [];

    $customTools[] = new \BinaryBuilds\NovaAdvancedCommandRunner\CommandRunner;

    # Define variable to hold the navigation
    $navigation = [ new CollapsibleResourceManager([
        'navigation' => [
            TopLevelResource::make([
                'label' => 'Resources',
                'resources' => $resources
            ])                    
        ]
    ]) ];

        # Merge the custom tools with resources navigation
        return array_merge($navigation, $customTools);
}

Unable to prepare route [nova-vendor/laravel-nova-translation-editor/index] for serialization. Uses Closure.

Hi there,

I was trying to run php artisan optimize when I got the following error message;

  LogicException  : Unable to prepare route [nova-vendor/laravel-nova-translation-editor/index] for serialization. Uses Closure.

  at /..../vendor/laravel/framework/src/Illuminate/Routing/Route.php:918
    914|     public function prepareForSerialization()
    915|     {
    916| 
    917|         if ($this->action['uses'] instanceof Closure) {
  > 918|             throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
    919|         }
    920| 
    921|         $this->compileRoute();


Is there a solution for this?

Config files should not be merged

I can't remove the 'auth' file because it is in the default configuration.

Or if you plan to add more config options later, then you should move the files in a sub key. That way you can keep the merge.
Something like:

return [
    'files' => [
        'auth',
    ],
];

Edit data of languages not save

Hello. When I save a message record from database languages table, it writes saved, but nothing changes in the database.. Nova 2.9.2. Table in database is not working,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.