Skip to content

export only missing keys #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
02bdfcf
support comma separated groups
AidasK Apr 5, 2019
5aa5a9b
export only missing translations
AidasK Apr 5, 2019
8fbda62
support of exporting multiple locales at once
AidasK Jun 18, 2019
4702f59
psr2 formating
AidasK Jun 18, 2019
331cb76
multi target locales support
AidasK Jun 18, 2019
bcc242c
refactor
AidasK Aug 5, 2019
7f50ce5
publish
AidasK Aug 5, 2019
e4d2bc6
update
AidasK Aug 5, 2019
4d77387
update
AidasK Aug 5, 2019
3807431
export command fixed
AidasK Aug 5, 2019
37676b4
zip support
AidasK Aug 6, 2019
b665388
fix provider
AidasK Aug 6, 2019
06094b2
zip feature
AidasK Aug 6, 2019
03ccad8
import refactor
AidasK Aug 6, 2019
c65841e
feature: validate
AidasK Aug 6, 2019
a16e4be
validation feature
AidasK Aug 6, 2019
54be38f
feature: validate files on import
AidasK Aug 8, 2019
cbcdfa4
fixed bugs
AidasK Aug 8, 2019
b6d7bbb
Update README.md
AidasK Aug 8, 2019
768223a
comments
AidasK Aug 8, 2019
943c394
feat: map columns
AidasK Aug 9, 2019
ad9f48d
html validation and xlsx support
AidasK Sep 9, 2019
14ad72e
fix html validator
AidasK Sep 9, 2019
67c46ca
feat: exclude group
AidasK Sep 18, 2019
e3ca4e0
laravel 6 support
AidasK Sep 18, 2019
83c8a25
Update composer.json to install phpspreadsheet
thomasgerard Mar 19, 2020
331acb2
Update composer.json
thomasgerard Mar 19, 2020
b1211c1
Update composer.json
thomasgerard Mar 19, 2020
0aea3c7
Update composer.json
thomasgerard Mar 19, 2020
89e9979
Merge pull request #2 from thomasgerard/master
AidasK Mar 19, 2020
817f624
add laravel 7 and up support
AidasK Jun 10, 2020
cedf510
fix laravel 7 support
AidasK Jun 10, 2020
a738d7c
Added export support for xls files, importing from multiple files and…
Afting Jun 23, 2020
254735f
added support for exporting to various file types
Afting Jul 2, 2020
2afb9a3
Merge pull request #3 from Afting/master
AidasK Jul 2, 2020
117d684
Update README.md
AidasK Jul 2, 2020
93bc84c
Update README.md
AidasK Jul 2, 2020
0aa235f
Update composer.json
AidasK Apr 11, 2022
9c77648
Update LangListService.php
AidasK Apr 11, 2022
e1a46b5
Update ValidationCommand.php
AidasK Apr 11, 2022
915cbc5
Update ImportFromCsvCommand.php
AidasK Apr 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ The MIT License (MIT)

Copyright (c) 2014 UFirst Group
Copyright (c) 2017 HighSolutions
Copyright (c) 2019 Aidas Klimas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
99 changes: 49 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
![Laravel-Lang-Import-Export by HighSolutions](https://github.com/highsolutions/laravel-lang-import-export/master/intro.jpg)

Laravel-Lang-Import-Export
<p align="center">
<img src="https://github.com/AidasK/laravel-lang-import-export/master/logo.png" titile="Laravel-Lang-Import-Export v6" width="400">
</p>

Laravel-Lang-Import-Export **(Refactored)**
==========================

This package provides artisan commands to import and export language files from and to CSV. This can be used to send translations to agencies that normally work with Excel-like files.
This package provides artisan commands to import and export language files from and to CSV. This can be used to send translations to agencies that normally work with Excel-like files. In practice, CSV format is supper easy to work with for any translator in Fiverr or for any other freelancer. Personally, I have tried every other format such as **php, yaml, docx, pod, txt** and all of them has too complex syntax and requires custom software to work with (Not to mention all those problems with file encodings). CSV solves it all! (Now supports **xls, xlsx, ods** file types too!)

# How It Works?

It turns some navigation.php file...

Expand Down Expand Up @@ -41,23 +46,17 @@ navigation.tips.play,"Autoplay the slide show"
Installation
------------

Add the following line to the `require` section of your Laravel webapp's `composer.json` file:

```javascript
"require": {
"HighSolutions/laravel-lang-import-export": "5.4.*"
}
```sh
composer require aidask/laravel-lang-import-export
```

Run `composer update` to install the package.

This package uses Laravel 5.5 Package Auto-Discovery.
For previous versions of Laravel, you need to update `config/app.php` by adding an entry for the service provider:

```php
'providers' => array(
/* ... */
'HighSolutions\LangImportExport\LangImportExportServiceProvider'
'LangImportExport\LangImportExportServiceProvider'
)
```

Expand All @@ -69,46 +68,53 @@ The package currently provides two commands, one for exporting the files and one
### Export

```bash
php artisan lang:export
php artisan lang:export en * path/to/export
php artisan lang:export en auth -A -X
php artisan lang:export --locale en
php artisan lang:export --locale en --target fr,de,pt # export en translations only missing in fr,de,pt locales. Each in separate files
php artisan lang:export -l fr,de,pt -z all.zip # archive all the files
php artisan lang:export --locale en -g pagination,validation # export only cretain groups
php artisan lang:export --locale en --exclude pagination,validation # export all files except pagination and validation
php artisan lang:export --locale en --ext xls # supported extensions: Xls, Xlsx, Ods, Csv, Html, Tcpdf, Mpdf, Dompdf
```

When you call command without parameters, export file will be generated for all localization files within default locale. But you can define **locale** explicitly. You can also export only one file (second parameter - **group**) and define where to store file (you can provide name with and without .csv extension). When you use **output** argument, default path is base_path() -> catalog of your whole project.
But there is few more useful parameters:

| name of parameter | description | is required? | default value |
|-------------------|-----------------------------------------|--------------|------------------------------------|
| locale | The locale to be exported | NO | default lang of application |
| group | The name of translation file to export | NO | \* - all files |
| output | Filename of exported translation files | NO | storage/app/lang-import-export.csv |
| -A / --append | Append name of group to the name of file | NO | empty |
| -X / --excel | Set file encoding (UTF-16) for Excel | NO | UTF-8 |
| -D / --delimiter | Field delimiter | NO | , |
| -E / --enclosure | Field enclosure | NO | " |

### Import

```bash
php artisan lang:import es.csv # localed autodetected from file name
php artisan lang:import espaniol.csv -l es
php artisan lang:import espaniol.csv -l es -g pagination,validation # import only cretain groups
php artisan lang:import es.csv -p --html # validate imported translations for missing placeholders and bad html (see below)
php artisan lang:import es.xls -p --column-map A,B,D # import translations from different column. E.g. C column was left with base language
```
php artisan lang:import
php artisan lang:import en * path/to/import
php artisan lang:import en auth -X

### Validate
```bash
php artisan lang:validate ar -m --html -v # find missing keys, bad html and placeholders
```
![Laravel-Lang-Import-Export validation example](https://github.com/AidasK/laravel-lang-import-export/master/validation.png)

When you call command without parameters - it will try to read default file of export command without parameters for default locale and all localization files. You can of course specify all parameters (**locale**, **group**, **input**) and there is few more options:

| name of parameter | description | is required? | default value |
|-------------------|----------------------------------------------|--------------|------------------------------------|
| locale | The locale to be imported | NO | default lang of application |
| group | The name of translation file to import | NO | * - all files |
| output | Filename of translation files to be imported | NO | storage/app/lang-import-export.csv |
| -X / --excel | Set file encoding from Excel | NO | UTF-8 |
| -D / --delimiter | Field delimiter | NO | , |
| -E / --enclosure | Field enclosure | NO | " |
| -C / --escape | Field escape | NO | \ |
### Config

You can export package config if you want to set defaults for the commands:
```bash
php artisan vendor:publish
```


Changelog
------------
6.4.0
* Added support to export to Xls, Xlsx, Ods, Csv, Html, Tcpdf, Mpdf, Dompdf file types
* You can now import translations from a zip file

6.2.0
* Validate HTML feature. Usually HTML tags are translated with random spaces such as "< /b>", which makes entire paragraph bold.
* Added support to import from xls, ods, xlsx, csv file types (PhpOffice integration)

6.1.0
* Validate placeholders feature

6.0.0
* refactor whole repository

5.4.10
* Laravel 5.7 support
Expand Down Expand Up @@ -142,17 +148,10 @@ Changelog
- add support for export and import all localization files
- any arguments are not required

Roadmap
------------

* Removing tabs from text
* Option for deleting export file after importing.
* Option for excluding certain files (and system ones).
* Unit tests!

Credits
------------

This package was originally created by [UFirst](http://github.com/ufirstgroup) and is available here: [Laravel-lang-import-export](https://github.com/ufirstgroup/laravel-lang-import-export).

Currently is developed by [HighSolutions](https://highsolutions.org), software house from Poland in love in Laravel.
Currently is developed by [Aidas Klimas](https://klimas.lt/), software house from Lithuania
24 changes: 16 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "highsolutions/laravel-lang-import-export",
"name": "aidask/laravel-lang-import-export",
"description": "A Laravel package providing artisan commands to import and export language files from and to CSV.",
"keywords": ["laravel", "localization", "translation", "messages", "import", "export", "CSV"],
"authors": [
{
"name": "Aidas Klimas",
"email": "aidaskk@gmail.com"
},
{
"name": "Michael Ruoss",
"email": "michael.ruoss@UFirstgroup.com"
Expand All @@ -14,25 +18,29 @@
],
"license": "MIT",
"require": {
"php": ">=5.6.4",
"illuminate/support": "5.x"
"php": ">=7",
"illuminate/support": ">=5",
"phpoffice/phpspreadsheet": "*"
},
"autoload": {
"psr-4": {
"HighSolutions\\LangImportExport\\": "src/"
"LangImportExport\\": "src/"
},
"files": [
"src/Support/helpers.php"
]
},
"suggest": {
"ext-zip": "zip exported files"
},
"extra": {
"component": "package",
"frameworks": ["Laravel 5.7"],
"frameworks": ["Laravel"],
"laravel": {
"providers": [
"HighSolutions\\LangImportExport\\LangImportExportServiceProvider"
]
"LangImportExport\\LangImportExportServiceProvider"
]
}
},
"minimum-stability": "stable"
"minimum-stability": "dev"
}
Binary file removed intro.jpg
Binary file not shown.
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading