Giter Club home page Giter Club logo

laravel-langman-gui's Introduction

Laravel Language Manager

Langman is a GUI for managing your JSON language files in a Laravel project.

Laravel Langman
Latest Stable Version Total Downloads License

Installation

Begin by installing the package through Composer. Run the following command in your terminal:

$ composer require themsaid/laravel-langman-gui

Once done, add the following line in your providers array of config/app.php:

Themsaid\LangmanGUI\LangmanServiceProvider::class

Then publish the configuration file & assets:

php artisan vendor:publish --provider=Themsaid\\LangmanGUI\\LangmanServiceProvider

Usage

Once you have added the Service Provider point your browser to http://project.dev/langman, using this interface you'll be able to browse translation keys in different languages, add/remove keys, scan your project files for missing translations, and finally save your changes to the language JSON files.

Backup

Langman stores a backup of your entire resources/lang directory into storage/langmanGUI, you can use restore the original files using this backup in case anything went wrong.

laravel-langman-gui's People

Contributors

atefbb avatar danijelk avatar grupa-leonardo avatar jakub-klapka avatar joedixon avatar mathieutu avatar nunomaduro avatar omranic avatar themsaid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-langman-gui's Issues

"0 Keys" error

Hi,

After installing the component in a new Laravel project and publishing the config, I have this error in browser:

Top menu:
Laravel Langman 0 Keys

Content:
There are no JSON translation keys in your project, start by creating json files for every language in your "resources/lang" directory. In case you have the files already created, you may now start adding keys or let Langman scan your project for lines to translate.

Environment:
OS: Windows 10 Pro
Laragon 2.2.2 (Apache 2.4.25, PHP 7.1.1)

Subclassing from Manager, please make it protected.

Hi,

I noticed the config('langmanGUI.route_group_config.namespace') actually allows us to switch to our own Controller extending from the base Controller, but some private methods & attributes are prohibiting me from doing so.

private $disk;
private function getTranslationsFromFiles()
private function backup()

Please kindly make these 'protected', thanks very much.

Bugged creating language and scaning for new lang file

Hi, maybe i did something wrong but when i go to /langman route i see i dont have JSON lang files and i can create it, after that into selecting language LINK i have double lang file name. When i try scan files i getting information about langman found new keys but this is not added for this lang. If i add something to en.json file manually and scan it, everything working perfect, but when i create new lang file manually(i can't create new file from langman GUI) i getting internal 500 error into browser console. If i add to new created file json array {} item is scan, but is not added to my new language.

If you can let me know step by step how can i add new translations and how i should work with langman.

//Edit: I fixed something from this buggs, tommorow i will add PR with this and maybe some improvments :D

Changes to view

Thanks for the great package. :)
Is there anyways I can make changes to the views? as I want to give facility to update languages to my team, so i want to make it feel as part of my own app.

Scan doesn't work on fresh project and install

Hi Mohammed,

I have a fresh install of everything and a single view with the following:

__("This is a test")

Clicking on the scan I can see that the endpoint does return the correct value:

["This is a test"]

but the Vue component throws the following error:

langman.js:42763 Uncaught TypeError: Cannot read property 'This is a test' of undefined at Vue$3.addNewKey (langman.js:42763) at Vue$3.boundFn [as addNewKey] (langman.js:33189) at _.forEach.key (langman.js:42835) at arrayEach (langman.js:14459) at Function.forEach (langman.js:23281) at Object.$.post.done.response (langman.js:42834) at fire (langman.js:6979) at Object.fireWith [as resolveWith] (langman.js:7109) at done (langman.js:12934) at XMLHttpRequest.<anonymous> (langman.js:13176)

Are you getting it also on a fresh install?

Scan doesn't detect @lang() strings?

When I run a fresh scan with this package it only finds strings that are echoed using the __ method and not strings using the @lang method.

Simply changing @lang('Back to overview) to {{ __('Back to overview') }}  and then running a scan will make the string appear among the keys.

I can work around this by using the __ method but it's a shame I have to manually change this now in all my views.

Is this expected behaviour or am I missing something?

Laravel 5.4, this package 0.3.1

🔈Calling for help

Hey everyone,

I've been trying to put more focus on this open source library for sometime but I keep failing. Sorry!

I'd like to ask for your help. Is there anyone willing to co-maintain this package? Or if you've been using it a lot for your work and you'd like to take over I'm happy to transfer the package to your account.

Thanks everyone, hope the package helped make your life easier :)

Redesign with two vertical sections

Hi,

You put strings into a fixed-width box. I think it's better to split the page into two vertical sections. the left one totally has strings and it fills whole its space and the other one is used to change strings as it is now.

Good Idea

It is very interesting i think i will test.
thx

Make the save and sync ajax call relative

My langman install wasnt saving the new keys and updates, but after some digging i found its because of the ajax call to "/langman/save". Since i dont run my project on the top level, this call fails. Editing it to "langman/save" solves the problem.

Would it be possible to fix it? Or is there a way that i can do it? :-)

Also, thank you for the great package. Helps me save some serious time with the translation woes.

It cannot find my languages

Hi,

My base language is fa, and the English lang path is /resources/lang/en/ but the tool continually says:

There are no JSON translation keys in your project, start by creating JSON
files for every language in your "resources/lang" directory.

In case you have the files already created, you may now start adding keys or
let Langman scan your project for lines to translate.

Change default font

Hi,

Provide an option to set a new font, please. Persian characters don't seem right in Arial, Tahoma, and etc.

It looks like vendor:publish don't do its job

Hello,
I've done installation by instruction

  • Run the command in terminal: composer require themsaid/laravel-langman-gui
  • add service into config/app.php: Themsaid\LangmanGUI\LangmanServiceProvider::class
  • publish the configuration file & assets: php artisan vendor:publish --provider=Themsaid\\LangmanGUI\\LangmanServiceProvider

I got response Publishing complete.

But nothing has been added to project public folder and config folder. Langman home page is without style and not working properly.

I use Laravel 5.5.

What can be wrong?

array lang files

Hello,

are there any plans to add support for array files also?

This seems to be very promising.

Thanks

Initial scan fails with "array_key_exists() expects parameter 2 to be array, null given"

On the initial scan of a fresh install, I got this error:

local.ERROR: array_key_exists() expects parameter 2 to be array, null given {"exception":"[object] (ErrorException(code: 0): array_key_exists() expects parameter 2 to be array, null given at /home/ubuntu/leadingre_com/vendor/themsaid/laravel-langman-gui/src/Manager.php:96)
[stacktrace]

Once I manually created the first key and translation, the scan worked and found all the existing keys in my views. Adding $keys = [] beneath the scan $output = []; should solve it.

Strange view

Hi,

I just installed this package on fresh installed laravel 5.5.23 and here is what i get:

screenshot-2017-12-9 langman

What should i do?

Filter the space around arguement in __() function

https://github.com/themsaid/laravel-langman-gui/blob/master/src/Manager.php#L151-L163

$pattern =
            // See https://regex101.com/r/jS5fX0/5
            '[^\w]'. // Must not start with any alphanum or _
            '(?<!->)'. // Must not start with ->
            '('.implode('|', $functions).')'.// Must start with one of the functions
            "\(".// Match opening parentheses
            "[\'\"]".// Match " or '
            '('.// Start a new group to match:
            '.+'.// Must start with group
            ')'.// Close group
            "[\'\"]".// Closing quote
            "[\),]"  // Close parentheses or new parameter
        ;

If there has space around the arguments in translate function,this pattern con not match .
like: __( 'langman' ).

$pattern =
            // See https://regex101.com/r/jS5fX0/5
            '[^\w]'. // Must not start with any alphanum or _
            '(?<!->)'. // Must not start with ->
            '('.implode('|', $functions).')'.// Must start with one of the functions
            "\(".// Match opening parentheses
            "\s".
            "[\'\"]".// Match " or '
            '('.// Start a new group to match:
            '.+'.// Must start with group
            ')'.// Close group
            "[\'\"]".// Closing quote
            "\s".
            "[\),]"  // Close parentheses or new parameter
        ;

Show unused strings

Hi,

Search and find the whole app for unused strings takes so much time. Can you do that by showing unused strings which defined in languages?

Middleware issue

Hi,

I have problem with making middleware for this package

here is what I tried so far:

1- code below in config/langmanGUI.php

'route_group_config' => [
        'middleware' => ['role:Admin'],
        'namespace' => 'Themsaid\LangmanGUI'
    ]
  • result: show page in both logged/not logged users

2- code above in vendor/config/langmanGUI.php

- result:

 Spatie \ Permission \ Exceptions \ UnauthorizedException
User is not logged in.

3- adding code below to LangmanController.php

public function __construct()
    {
        $this->middleware(['role:Admin|Editor']);
    }

- result:

 Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined method Themsaid\LangmanGUI\LangmanController::middleware()

any idea how to fix it?

trans_choice not picked up

Hi,

Great package, thanks for that!

One tiny little hiccup for me is I was using {{ trans('Some string') }} and those didn't get picked up by the scan. I changed them all to __('') which were scanned properly.

That does leave me with quite a few {{ trans_choice(...) }} that are not getting scanned.

Do you plan on supporting those at some point?

scans wrong keys

Hi Themsaid, thanks for your work in L, Im trying your tool, and when I scan, Im getting that is getting this as key:

')}}</th>
            <th class="border-top-0">{{__('Created

in reality, theres 2 keys, like this:

<th class="border-top-0">{{__('Client')}}</th>
            <th class="border-top-0">{{__('Created')}}</th>

Appreciate all the help

Pluralization

I suppose json implementation doesn't provide pluralization?
Definitely not an issue for your great tool, just asking...

[BUG] It should ignore backslashes

Hi,

Langman currently doesn't ignore backslashes. It scans if you\'re not the one and cannot recognize "if you're not the one" in strings.

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.