Skip to content

Commit

Permalink
Merge pull request #9 from Skysplit/laravel-6-improvements
Browse files Browse the repository at this point in the history
Laravel 6 improvements
  • Loading branch information
duxthefux authored Apr 7, 2020
2 parents 475a417 + c546cb3 commit a06fa8d
Show file tree
Hide file tree
Showing 23 changed files with 691 additions and 532 deletions.
47 changes: 47 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);


$root = __DIR__;

$finder = \PhpCsFixer\Finder::create()
->exclude('vendor')
->in($root);

return \PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR1' => true,
'@PSR2' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@PhpCsFixer' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'return_assignment' => false,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'dir_constant' => true,
'elseif' => false,
'ereg_to_preg' => true,
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'mb_str_functions' => false, // RISKY: as in some function we need to use strlen() to get length of bytes instead mb_strlen()
'phpdoc_order' => true,
'concat_space' => ['spacing' => 'one'],
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_classes' => true,
],
'phpdoc_to_comment' => false,
'method_argument_space' => ['on_multiline' => 'ignore'],
'php_unit_ordered_covers' => false,
])
->setCacheFile(sys_get_temp_dir() . '/php_cs.cache')
->setFinder($finder);
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
language: php

php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.4'
- hhvm

matrix:
allow_failures:
- php: '7.1'
- php: hhvm

cache:
Expand All @@ -20,4 +18,5 @@ before_script:
- composer install --dev

script:
- composer lint
- phpunit
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Laravel5 Intl Translator
# Laravel Intl Translator

[![Build Status](https://travis-ci.org/Skysplit/laravel5-intl-translation.svg?branch=master)](https://travis-ci.org/Skysplit/laravel5-intl-translation)
[![Latest Stable Version](https://poser.pugx.org/skysplit/laravel5-intl-translation/v/stable)](https://packagist.org/packages/skysplit/laravel5-intl-translation)
Expand All @@ -17,7 +17,7 @@
- [Formatting in details](#formatting-in-details)

# Introduction
**Laravel5 Intl Translator** uses php-intl extension to provide translation for your application.
**Laravel Intl Translator** uses php-intl extension to provide translation for your application.

Please mind that this package **breaks framework default behaviour for validators**.

Expand All @@ -31,7 +31,7 @@ app('translator')->formatMessage($locale, $message, $params)
```

# Requirements
- Laravel **5.2** or **5.3**
- Laravel **6**
- php-intl extension installed

Please feel free to contribute to this package for other Laravel versions support!
Expand All @@ -45,21 +45,6 @@ $ sudo apt-get install php-intl

If you have other OS, you can use it's respective package manager


---

### Laravel 5.3

```bash
composer require skysplit/laravel5-intl-translation=^2.0
```

### Laravel 5.2
```bash
composer require skysplit/laravel5-intl-translation=^1.0
```


## All versions

In your `config/app.php` providers
Expand Down
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@
]
},
"require": {
"php": ">=7.2.0",
"ext-intl": "*",
"illuminate/support": "^5.8|^6",
"illuminate/translation": "^5.8|^6",
"illuminate/validation": "^5.8|^6"
"illuminate/support": "^6",
"illuminate/translation": "^6",
"illuminate/validation": "^6"
},
"require-dev": {
"orchestra/testbench": "^3.3",
"phpunit/phpunit": "^4.0|^5.0"
"phpunit/phpunit": "^8.0",
"friendsofphp/php-cs-fixer": "^2.16"
},
"scripts": {
"lint-fix": "php vendor/bin/php-cs-fixer fix --config=.php_cs",
"lint": "php vendor/bin/php-cs-fixer fix --config=.php_cs --dry-run"
}
}
5 changes: 3 additions & 2 deletions config/translator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

declare(strict_types=1);

return [
'region' => null
'region' => null,
];

4 changes: 2 additions & 2 deletions resources/lang/en/auth.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

return [
declare(strict_types=1);

return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
Expand All @@ -15,5 +16,4 @@

'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in {seconds, plural, =1{# second} other{# seconds}}.',

];
121 changes: 62 additions & 59 deletions resources/lang/en/validation.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

return [
declare(strict_types=1);

return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
Expand All @@ -13,72 +14,75 @@
|
*/

'accepted' => 'The {attribute} must be accepted.',
'active_url' => 'The {attribute} is not a valid URL.',
'after' => 'The {attribute} must be a date after {date}.',
'alpha' => 'The {attribute} may only contain letters.',
'alpha_dash' => 'The {attribute} may only contain letters, numbers, and dashes.',
'alpha_num' => 'The {attribute} may only contain letters and numbers.',
'array' => 'The {attribute} must be an array.',
'before' => 'The {attribute} must be a date before {date}.',
'between' => [
'accepted' => 'The {attribute} must be accepted.',
'active_url' => 'The {attribute} is not a valid URL.',
'after' => 'The {attribute} must be a date after {date}.',
'after_or_equal' => 'The {attribute} must be a date after or equal to {date}.',
'alpha' => 'The {attribute} may only contain letters.',
'alpha_dash' => 'The {attribute} may only contain letters, numbers, and dashes.',
'alpha_num' => 'The {attribute} may only contain letters and numbers.',
'array' => 'The {attribute} must be an array.',
'before' => 'The {attribute} must be a date before {date}.',
'before_or_equal' => 'The {attribute} must be a date before or equal to {date}.',
'between' => [
'numeric' => 'The {attribute} must be between {min} and {max}.',
'file' => 'The {attribute} must be between {min} and {max} kilobytes.',
'string' => 'The {attribute} must be between {min} and {max} characters.',
'array' => 'The {attribute} must have between {min} and {max} items.',
'file' => 'The {attribute} must be between {min} and {max} kilobytes.',
'string' => 'The {attribute} must be between {min} and {max} characters.',
'array' => 'The {attribute} must have between {min} and {max} items.',
],
'boolean' => 'The {attribute} field must be true or false.',
'confirmed' => 'The {attribute} confirmation does not match.',
'date' => 'The {attribute} is not a valid date.',
'date_format' => 'The {attribute} does not match the format {format}.',
'different' => 'The {attribute} and {other} must be different.',
'digits' => 'The {attribute} must be {digits} digits.',
'digits_between' => 'The {attribute} must be between {min} and {max} digits.',
'distinct' => 'The {attribute} field has a duplicate value.',
'email' => 'The {attribute} must be a valid email address.',
'exists' => 'The selected {attribute} is invalid.',
'filled' => 'The {attribute} field is required.',
'image' => 'The {attribute} must be an image.',
'in' => 'The selected {attribute} is invalid.',
'in_array' => 'The {attribute} field does not exist in {other}.',
'integer' => 'The {attribute} must be an integer.',
'ip' => 'The {attribute} must be a valid IP address.',
'json' => 'The {attribute} must be a valid JSON string.',
'max' => [
'boolean' => 'The {attribute} field must be true or false.',
'confirmed' => 'The {attribute} confirmation does not match.',
'date' => 'The {attribute} is not a valid date.',
'date_format' => 'The {attribute} does not match the format {format}.',
'different' => 'The {attribute} and {other} must be different.',
'digits' => 'The {attribute} must be {digits} digits.',
'digits_between' => 'The {attribute} must be between {min} and {max} digits.',
'distinct' => 'The {attribute} field has a duplicate value.',
'email' => 'The {attribute} must be a valid email address.',
'exists' => 'The selected {attribute} is invalid.',
'filled' => 'The {attribute} field is required.',
'image' => 'The {attribute} must be an image.',
'in' => 'The selected {attribute} is invalid.',
'in_array' => 'The {attribute} field does not exist in {other}.',
'integer' => 'The {attribute} must be an integer.',
'ip' => 'The {attribute} must be a valid IP address.',
'json' => 'The {attribute} must be a valid JSON string.',
'max' => [
'numeric' => 'The {attribute} may not be greater than {max}.',
'file' => 'The {attribute} may not be greater than {max, plural, =1{# kilobyte} other{# kilobytes}}.',
'string' => 'The {attribute} may not be greater than {max, plural, =1{# character} other{# characters}}.',
'array' => 'The {attribute} may not have more than {max, plural, =1{# item} other{# items}}.',
'file' => 'The {attribute} may not be greater than {max, plural, =1{# kilobyte} other{# kilobytes}}.',
'string' => 'The {attribute} may not be greater than {max, plural, =1{# character} other{# characters}}.',
'array' => 'The {attribute} may not have more than {max, plural, =1{# item} other{# items}}.',
],
'mimes' => 'The {attribute} must be a file of type: {values}.',
'min' => [
'mimes' => 'The {attribute} must be a file of type: {values}.',
'min' => [
'numeric' => 'The {attribute} must be at least {min}.',
'file' => 'The {attribute} must be at least {min, plural, =1{# kilobyte} other{# kilobytes}}.',
'string' => 'The {attribute} must be at least {min, plural, =1{# character} other{# characters}}.',
'array' => 'The {attribute} must have at least {min, plural, =1{# item} other{# items}}.',
'file' => 'The {attribute} must be at least {min, plural, =1{# kilobyte} other{# kilobytes}}.',
'string' => 'The {attribute} must be at least {min, plural, =1{# character} other{# characters}}.',
'array' => 'The {attribute} must have at least {min, plural, =1{# item} other{# items}}.',
],
'not_in' => 'The selected {attribute} is invalid.',
'numeric' => 'The {attribute} must be a number.',
'present' => 'The {attribute} field must be present.',
'regex' => 'The {attribute} format is invalid.',
'required' => 'The {attribute} field is required.',
'required_if' => 'The {attribute} field is required when {other} is {value}.',
'required_unless' => 'The {attribute} field is required unless {other} is in {values}.',
'required_with' => 'The {attribute} field is required when {values} is present.',
'required_with_all' => 'The {attribute} field is required when {values} is present.',
'required_without' => 'The {attribute} field is required when {values} is not present.',
'not_in' => 'The selected {attribute} is invalid.',
'numeric' => 'The {attribute} must be a number.',
'present' => 'The {attribute} field must be present.',
'regex' => 'The {attribute} format is invalid.',
'required' => 'The {attribute} field is required.',
'required_if' => 'The {attribute} field is required when {other} is {value}.',
'required_unless' => 'The {attribute} field is required unless {other} is in {values}.',
'required_with' => 'The {attribute} field is required when {values} is present.',
'required_with_all' => 'The {attribute} field is required when {values} is present.',
'required_without' => 'The {attribute} field is required when {values} is not present.',
'required_without_all' => 'The {attribute} field is required when none of {values} are present.',
'same' => 'The {attribute} and {other} must match.',
'size' => [
'same' => 'The {attribute} and {other} must match.',
'size' => [
'numeric' => 'The {attribute} must be {size}.',
'file' => 'The {attribute} must be {size, plural, =1{# kilobyte} other{# kilobytes}}.',
'string' => 'The {attribute} must be {size, plural, =1{# character} other{# characters}}.',
'array' => 'The {attribute} must contain {size, plural, =1{# item} other{# items}}.',
'file' => 'The {attribute} must be {size, plural, =1{# kilobyte} other{# kilobytes}}.',
'string' => 'The {attribute} must be {size, plural, =1{# character} other{# characters}}.',
'array' => 'The {attribute} must contain {size, plural, =1{# item} other{# items}}.',
],
'string' => 'The {attribute} must be a string.',
'timezone' => 'The {attribute} must be a valid zone.',
'unique' => 'The {attribute} has already been taken.',
'url' => 'The {attribute} format is invalid.',
'string' => 'The {attribute} must be a string.',
'starts_with' => 'The {attribute} must start with one of the following: {values}',
'timezone' => 'The {attribute} must be a valid zone.',
'unique' => 'The {attribute} has already been taken.',
'url' => 'The {attribute} format is invalid.',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -109,5 +113,4 @@
*/

'attributes' => [],

];
4 changes: 2 additions & 2 deletions resources/lang/pl/auth.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

return [
declare(strict_types=1);

return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
Expand All @@ -15,5 +16,4 @@

'failed' => 'Błędny login lub hasło.',
'throttle' => 'Za dużo nieudanych prób logowania. Proszę spróbować za {seconds, plural, one{# sekundę} few{# sekundy} many{# sekund} other{sekundy}}.',

];
8 changes: 5 additions & 3 deletions resources/lang/pl/pagination.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

declare(strict_types=1);

return [

/*
|--------------------------------------------------------------------------
| Pagination Language Lines
Expand All @@ -11,7 +13,7 @@
| you want to customize your views to better match your application.
|
*/

'previous' => '&laquo; Poprzednia',
'next' => 'Następna &raquo;',
'next' => 'Następna &raquo;',
];
14 changes: 8 additions & 6 deletions resources/lang/pl/passwords.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

declare(strict_types=1);

return [

/*
|--------------------------------------------------------------------------
| Password Reminder Language Lines
Expand All @@ -11,10 +13,10 @@
| has failed, such as for an invalid token or invalid new password.
|
*/

'password' => 'Hasło musi mieć przynajmniej sześć znaków i zgadzać się z potwierdzeniem.',
'reset' => 'Hasło zostało zresetowane!',
'sent' => 'Przypomnienie hasła zostało wysłane!',
'token' => 'Token resetowania hasła jest nieprawidłowy.',
'user' => 'Nie znaleziono użytkownika z takim adresem e-mail.',
'reset' => 'Hasło zostało zresetowane!',
'sent' => 'Przypomnienie hasła zostało wysłane!',
'token' => 'Token resetowania hasła jest nieprawidłowy.',
'user' => 'Nie znaleziono użytkownika z takim adresem e-mail.',
];
Loading

0 comments on commit a06fa8d

Please sign in to comment.