GithubHelp home page GithubHelp logo

lukasss93 / laravel-larex Goto Github PK

View Code? Open in Web Editor NEW
90.0 90.0 7.0 372 KB

Laravel Larex lets you translate your whole Laravel application with a single CSV file.

License: MIT License

PHP 100.00%
csv i18n laravel localization php

laravel-larex's Introduction

Hi there ๐Ÿ‘‹

I'm a Full-Stack Developer working in Milan, Italy.

Views

laravel-larex's People

Contributors

lukasss93 avatar stylecibot avatar tiaxter 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

Watchers

 avatar  avatar  avatar  avatar

laravel-larex's Issues

Not standard csv file

The current csv delimiter is ";" instead of ",".
It's necessary to change it to support standard csv files provided by external programs like google sheets, etc...

Invalid escaping on export command

Value on CSV:

group;key;en
app;example;This is a \"string\"

Value after export command:

// resources/lang/en/app.php
<?php

return [
    'example' => 'This is a \"string\"'
];

How it should be:

// resources/lang/en/app.php
<?php

return [
    'example' => 'This is a "string"'
];

No way of ordering languages with import command.

The larex:import command orders languages alphabetically to the CSV.
How can you order them differently?
In my case using the larex crowdin plugin that wants the third key to be the source language and my file: group,key,af,am,ar,en

wrong export

if the last column has a single space without enclosure, it will not be exported.

Change commands export/import

The commands larex:export and larex:import could be confusing to users.

Possible solutions:

  • Replace larex:export with larex:build:lang and larex:import with larex:build:csv
  • Add larex:build:lang as alias for larex:export and larex:build:csv as alias for larex:import

Wrong enclosure with larex:insert

The larex:insert command add wrong enclosure if there is a quotation mark with a comma.

Example:

Input:
test "cool" and, oops

Output:
""test ""cool"" and, oops""

Expected:
"test ""cool"" and, oops"

Add support for "Overriding Package Language Files"

https://laravel.com/docs/9.x/localization#overriding-package-language-files

Which path to take?

A) Create another localization.csv for every package inside /lang/vendor/. Example:

  • /lang/vendor/packageA/localization.csv
  • /lang/vendor/packageB/localization.csv

B) Use the default localization.csv file using an alias prefix in the larex.php config

// <project-root>/config/larex.php

'vendor' => [
    'enabled' => false,
    'prefix' => 'vendor',
    'alias' => [
        'packageA' => 'a',
        'packageB' => 'b',
    ]
]
group key en it
vendor.a.app car Car Auto
vendor.b.common hello Hello Ciao

Sentences with line break aren't escaped!

Input:

group;key;en
app;test;test
app;hello;"hello
friends"
app;ok;ok

After larex:sort (missing escaping):

group;key;en
app;hello;hello
friends
app;ok;ok
app;test;test

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.