Skip to content

Commit

Permalink
Merge pull request #44 from ARCANEDEV/develop
Browse files Browse the repository at this point in the history
Adding Laravel 9 Support
  • Loading branch information
arcanedev-maroc authored Mar 12, 2022
2 parents a9a8cda + dddf1f3 commit 3609b43
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 159 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.3, 7.4, 8.0]
php: [8.0, 8.1]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
Expand All @@ -24,7 +24,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-8-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 6
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/LaravelLang/r
* Easy setup & configuration.
* Missing translations Checker.
* Translations Publisher.
* Laravel `5.x` to `8.x` are supported.
* Laravel `5.x` to `9.x` are supported.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Made with :heart: & :coffee:.
Expand Down Expand Up @@ -49,16 +49,16 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [ARCANEDEV][link-author]
- [All Contributors][link-contributors]

[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-lang.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%208.x-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelLang/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/8ed2a842-3f4e-4422-a881-cf7eb72a595d.svg?style=flat-square
[badge_issues]: https://img.shields.io/github/issues/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_package]: https://img.shields.io/badge/package-arcanedev/laravel--lang-blue.svg?style=flat-square
[badge_release]: https://img.shields.io/packagist/v/arcanedev/laravel-lang.svg?style=flat-square
[badge_downloads]: https://img.shields.io/packagist/dt/arcanedev/laravel-lang.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-lang.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%209.x-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelLang/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/8ed2a842-3f4e-4422-a881-cf7eb72a595d.svg?style=flat-square
[badge_issues]: https://img.shields.io/github/issues/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_package]: https://img.shields.io/badge/package-arcanedev/laravel--lang-blue.svg?style=flat-square
[badge_release]: https://img.shields.io/packagist/v/arcanedev/laravel-lang.svg?style=flat-square
[badge_downloads]: https://img.shields.io/packagist/dt/arcanedev/laravel-lang.svg?style=flat-square

[link-author]: https://github.com/arcanedev-maroc
[link-github-repo]: https://github.com/ARCANEDEV/LaravelLang
Expand Down
19 changes: 0 additions & 19 deletions _docs/0-Home.md

This file was deleted.

33 changes: 18 additions & 15 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@

## Version Compatibility

| Laravel | LaravelLang |
|:-----------------------------|:--------------------------------------|
| ![Laravel v8.x][laravel_8_x] | ![LaravelLang v9.x][laravel_lang_9_x] |
| ![Laravel v7.x][laravel_7_x] | ![LaravelLang v8.x][laravel_lang_8_x] |
| ![Laravel v6.x][laravel_6_x] | ![LaravelLang v7.x][laravel_lang_7_x] |
| ![Laravel v5.8][laravel_5_8] | ![LaravelLang v6.x][laravel_lang_6_x] |
| ![Laravel v5.7][laravel_5_7] | ![LaravelLang v5.x][laravel_lang_5_x] |
| ![Laravel v5.6][laravel_5_6] | ![LaravelLang v4.x][laravel_lang_4_x] |
| ![Laravel v5.5][laravel_5_5] | ![LaravelLang v3.x][laravel_lang_3_x] |
| ![Laravel v5.4][laravel_5_4] | ![LaravelLang v2.x][laravel_lang_2_x] |
| ![Laravel v5.3][laravel_5_3] | ![LaravelLang v1.x][laravel_lang_1_x] |
| ![Laravel v5.2][laravel_5_2] | ![LaravelLang v1.x][laravel_lang_1_x] |
| ![Laravel v5.1][laravel_5_1] | ![LaravelLang v1.x][laravel_lang_1_x] |
| ![Laravel v5.0][laravel_5_0] | ![LaravelLang v1.x][laravel_lang_1_x] |

| Laravel | LaravelLang |
|:-----------------------------|:----------------------------------------|
| ![Laravel v9.x][laravel_9_x] | ![LaravelLang v10.x][laravel_lang_10_x] |
| ![Laravel v8.x][laravel_8_x] | ![LaravelLang v9.x][laravel_lang_9_x] |
| ![Laravel v7.x][laravel_7_x] | ![LaravelLang v8.x][laravel_lang_8_x] |
| ![Laravel v6.x][laravel_6_x] | ![LaravelLang v7.x][laravel_lang_7_x] |
| ![Laravel v5.8][laravel_5_8] | ![LaravelLang v6.x][laravel_lang_6_x] |
| ![Laravel v5.7][laravel_5_7] | ![LaravelLang v5.x][laravel_lang_5_x] |
| ![Laravel v5.6][laravel_5_6] | ![LaravelLang v4.x][laravel_lang_4_x] |
| ![Laravel v5.5][laravel_5_5] | ![LaravelLang v3.x][laravel_lang_3_x] |
| ![Laravel v5.4][laravel_5_4] | ![LaravelLang v2.x][laravel_lang_2_x] |
| ![Laravel v5.3][laravel_5_3] | ![LaravelLang v1.x][laravel_lang_1_x] |
| ![Laravel v5.2][laravel_5_2] | ![LaravelLang v1.x][laravel_lang_1_x] |
| ![Laravel v5.1][laravel_5_1] | ![LaravelLang v1.x][laravel_lang_1_x] |
| ![Laravel v5.0][laravel_5_0] | ![LaravelLang v1.x][laravel_lang_1_x] |

[laravel_9_x]: https://img.shields.io/badge/version-9.x-blue.svg?style=flat-square "Laravel v9.x"
[laravel_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "Laravel v8.x"
[laravel_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "Laravel v7.x"
[laravel_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "Laravel v6.x"
Expand All @@ -36,6 +38,7 @@
[laravel_5_1]: https://img.shields.io/badge/version-5.1-blue.svg?style=flat-square "Laravel v5.1"
[laravel_5_0]: https://img.shields.io/badge/version-5.0-blue.svg?style=flat-square "Laravel v5.0"

[laravel_lang_10_x]: https://img.shields.io/badge/version-10.x-blue.svg?style=flat-square "LaravelLang v10.x"
[laravel_lang_9_x]: https://img.shields.io/badge/version-9.x-blue.svg?style=flat-square "LaravelLang v9.x"
[laravel_lang_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "LaravelLang v8.x"
[laravel_lang_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "LaravelLang v7.x"
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arcanedev/laravel-lang",
"description": "Translations manager and checker for Laravel based on 'caouecs/laravel-lang' package.",
"description": "Translations manager and checker for Laravel based on 'Laravel-Lang/lang' package.",
"homepage": "https://github.com/ARCANEDEV/LaravelLang",
"keywords": [
"arcanedev", "laravel", "translations", "trans", "languages", "lang", "localisation", "localization", "validations"
Expand All @@ -16,15 +16,15 @@
"type": "library",
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"arcanedev/support": "^8.0",
"laravel-lang/lang": "^9.0"
"php": "^8.0",
"arcanedev/support": "^9.0",
"laravel-lang/lang": "^10.4.2"
},
"require-dev": {
"laravel/framework": "^8.40",
"mockery/mockery": "^1.4.2",
"orchestra/testbench-core": "^6.4",
"phpunit/phpunit": "^9.3.3"
"laravel/framework": "^9.0",
"mockery/mockery": "^1.4.4",
"orchestra/testbench-core": "^7.0",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
Expand All @@ -43,7 +43,7 @@
},
"extra": {
"branch-alias": {
"dev-develop": "9.x-dev"
"dev-develop": "10.x-dev"
},
"laravel": {
"providers": [
Expand Down
31 changes: 25 additions & 6 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class TestCase extends BaseTestCase
*/
protected $locales = [
'af', 'ar', 'az', 'be', 'bg', 'bn', 'bs', 'ca', 'cs', 'cy', 'da', 'de', 'de_CH', 'el', 'es', 'et', 'eu', 'fa',
'fi', 'fil', 'fr', 'gl', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'kn', 'ko',
'fi', 'fil', 'fr', 'gl', 'gu', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'kn', 'ko',
'lt', 'lv', 'mk', 'mn', 'mr', 'ms', 'nb', 'ne', 'nl', 'nn', 'oc', 'pl', 'ps', 'pt', 'pt_BR', 'ro', 'ru', 'sc',
'si', 'sk', 'sl', 'sq', 'sr_Cyrl', 'sr_Latn', 'sr_Latn_ME', 'sv', 'sw', 'tg', 'th', 'tk', 'tl', 'tr', 'ug', 'uk',
'ur', 'uz_Cyrl', 'uz_Latn', 'vi', 'zh_CN', 'zh_HK', 'zh_TW',
Expand Down Expand Up @@ -98,7 +98,7 @@ private function copyLanguagesFixtures($app)

$filesystem->copyDirectory(
realpath(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'lang'),
realpath(resource_path('lang'))
$app->langPath()
);
}

Expand All @@ -121,8 +121,25 @@ protected function filesystem()
*/
protected function cleanLangDirectory(string $locale): bool
{
return $this->filesystem()
->cleanDirectory($this->app->langPath().DIRECTORY_SEPARATOR.$locale);
return $this
->filesystem()
->cleanDirectory($this->app->langPath().DIRECTORY_SEPARATOR.$locale)
;
}

/**
* Determine if the lang directory exists.
*
* @param string $locale
*
* @return bool
*/
protected function langDirectoryExists(string $locale): bool
{
return $this
->filesystem()
->exists($this->app->langPath().DIRECTORY_SEPARATOR.$locale)
;
}

/**
Expand All @@ -134,8 +151,10 @@ protected function cleanLangDirectory(string $locale): bool
*/
protected function deleteLangDirectory(string $locale): bool
{
return $this->filesystem()
->deleteDirectory($this->app->langPath().DIRECTORY_SEPARATOR.$locale);
return $this
->filesystem()
->deleteDirectory($this->app->langPath().DIRECTORY_SEPARATOR.$locale)
;
}

/**
Expand Down
14 changes: 14 additions & 0 deletions tests/TransPublisherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ public function it_can_publish(): void
{
$locale = 'es';

if ($this->langDirectoryExists($locale))
$this->deleteLangDirectory($locale);

static::assertEquals([
'published' => [
'es/auth.php',
'es/es.json',
'es/pagination.php',
'es/passwords.php',
'es/validation-nova.php',
'es/validation.php',
],
'skipped' => [],
Expand All @@ -83,6 +87,7 @@ public function it_can_publish(): void
'es/es.json',
'es/pagination.php',
'es/passwords.php',
'es/validation-nova.php',
'es/validation.php',
],
'skipped' => [],
Expand All @@ -97,12 +102,16 @@ public function it_can_not_publish_if_is_not_forced(): void
{
$locale = 'es';

if ($this->langDirectoryExists($locale))
$this->deleteLangDirectory($locale);

static::assertEquals([
'published' => [
'es/auth.php',
'es/es.json',
'es/pagination.php',
'es/passwords.php',
'es/validation-nova.php',
'es/validation.php',
],
'skipped' => [],
Expand All @@ -115,6 +124,7 @@ public function it_can_not_publish_if_is_not_forced(): void
'es/es.json',
'es/pagination.php',
'es/passwords.php',
'es/validation-nova.php',
'es/validation.php',
],
], $this->publisher->publish($locale));
Expand All @@ -128,12 +138,16 @@ public function it_can_publish_on_force(): void
{
$locale = 'es';

if ($this->langDirectoryExists($locale))
$this->deleteLangDirectory($locale);

$excepted = [
'published' => [
'es/auth.php',
'es/es.json',
'es/pagination.php',
'es/passwords.php',
'es/validation-nova.php',
'es/validation.php',
],
'skipped' => [],
Expand Down
17 changes: 17 additions & 0 deletions tests/fixtures/lang/en/validation-nova-inline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/

'attached' => 'This field is already attached.',
'relatable' => 'This field may not be associated with this resource.',
];
17 changes: 17 additions & 0 deletions tests/fixtures/lang/en/validation-nova.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/

'attached' => 'This :attribute is already attached.',
'relatable' => 'This :attribute may not be associated with this resource.',
];
Loading

0 comments on commit 3609b43

Please sign in to comment.