-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from Laravel-Lang/5.x
Bump Publisher to version 15
- Loading branch information
Showing
14 changed files
with
280 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# From `caouecs/laravel-lang` | ||
|
||
If you are using the old version of the `laravel-lang/lang` package when it was called `caouecs/laravel-lang`, then you | ||
need to follow the steps below to upgrade. | ||
|
||
You also need to remove all package managers responsible for installing localizations in the project. You can do all | ||
this with one command: | ||
|
||
```bash:no-line-numbers | ||
composer remove caouecs/laravel-lang laravel-lang/publisher overtrue/laravel-lang arcanedev/laravel-lang andrey-helldar/laravel-lang-publisher | ||
``` | ||
|
||
Next, you need to delete the `config/lang-publisher.php` file if it exists: | ||
|
||
```bash:no-line-numbers | ||
rm -f config/lang-publisher.php | ||
``` | ||
|
||
After that, you can install the latest version of `Laravel Lang`: | ||
|
||
```bash:no-line-numbers | ||
composer require laravel-lang/common --dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# To 5 from 4 | ||
|
||
* [Updating Dependencies](#updating-dependencies) | ||
* [Upgrade publisher](#upgrade-publisher) | ||
|
||
## Updating Dependencies | ||
|
||
You should update the following dependency in your application's `composer.json` file: | ||
|
||
* `laravel-lang/common` to `^5.0` | ||
|
||
Rename the configuration file: | ||
|
||
```bash | ||
mv config/lang-publisher.php config/localization.php | ||
``` | ||
|
||
Run the update dependency console command: | ||
|
||
```bash | ||
composer update | ||
``` | ||
|
||
## Upgrade publisher | ||
|
||
If you use access to locales or a locale helper in production, then also follow the necessary steps described in | ||
the [publisher upgrade section](../publisher/15.md#new-constants-namespace). | ||
|
||
## Using in production | ||
|
||
If you use access to facades and locales in production, then you also need to perform the following steps: | ||
|
||
```bash | ||
composer require laravel-lang/common --dev --quiet | ||
composer require laravel-lang/locales | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# From `laravel-lang/*` | ||
|
||
::: tip | ||
Check the version of the framework and PHP against the [compatibility](../compatibility/common.md) table. | ||
::: | ||
|
||
First remove the old dependencies: | ||
|
||
```bash:no-line-numbers | ||
composer remove laravel-lang/publisher laravel-lang/lang laravel-lang/attributes laravel-lang/http-statuses | ||
``` | ||
|
||
After that, install the `laravel-lang/common` version of the desired version. | ||
|
||
```bash:no-line-numbers | ||
composer require laravel-lang/common --dev | ||
``` | ||
|
||
If you want to use the list of locales in production, then install the dependency separately: | ||
|
||
```bash:no-line-numbers | ||
composer require laravel-lang/locales | ||
``` | ||
|
||
Enjoy! 🙂 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# To 15 from 14 | ||
|
||
* [Updating Dependencies](#updating-dependencies) | ||
* [New constants namespace](#new-constants-namespace) | ||
* [New facade helper](#new-facade-helper) | ||
* [Using in production](#using-in-production) | ||
|
||
## Updating Dependencies | ||
|
||
You should update the following dependency in your application's `composer.json` file: | ||
|
||
* `laravel-lang/publisher` to `^15.0` | ||
|
||
Rename the configuration file: | ||
|
||
```bash | ||
mv config/lang-publisher.php config/localization.php | ||
``` | ||
|
||
Run the update dependency console command: | ||
|
||
```bash | ||
composer update | ||
``` | ||
|
||
## New constants namespace | ||
|
||
Replace the locales namespace: | ||
|
||
```php | ||
LaravelLang\Publisher\Constants\Locales | ||
``` | ||
|
||
with | ||
|
||
```php | ||
LaravelLang\Locales\Enums\Locale | ||
``` | ||
|
||
For example: | ||
|
||
```php | ||
// Before | ||
LaravelLang\Publisher\Constants\Locales::AFRIKAANS; // af | ||
|
||
// After | ||
LaravelLang\Locales\Enums\Locale::Afrikaans; // af | ||
``` | ||
|
||
The name of the cases is aligned with the [PER standard](https://www.php-fig.org/per/coding-style/#9-enumerations). | ||
|
||
Also changed [aliases](../../../usage/aliases.md) section in the configuration file. | ||
|
||
## New facade helper | ||
|
||
### Before | ||
|
||
```php | ||
LaravelLang\Publisher\Facades\Helpers\Locales::available(); // array<string> | ||
// ['en', 'fr', 'de', ...] | ||
|
||
LaravelLang\Publisher\Facades\Helpers\Locales::getDefault(); // string | ||
// de-DE | ||
``` | ||
|
||
### After | ||
|
||
```php | ||
LaravelLang\Locales\Facades\Locales::available(); // array<LocaleData> | ||
// [<object>, <object>, ...] | ||
|
||
LaravelLang\Locales\Facades\Locales::getDefault(); // LocaleData | ||
// <object> | ||
|
||
LaravelLang\Locales\Facades\Locales::raw()->available(); // array<string> | ||
// ['en', 'fr', 'de', ...] | ||
|
||
LaravelLang\Locales\Facades\Locales::raw()->getDefault(); // string | ||
// de-DE | ||
``` | ||
|
||
`<object>` is a DTO class of `LocaleData`: | ||
|
||
```php | ||
// Non aliased | ||
LaravelLang\Locales\Data\LocaleData { | ||
+code: "de" | ||
+type: "Latn" | ||
+name: "German" | ||
+native: "Deutsch" | ||
+regional: "de_DE" | ||
} | ||
|
||
// Aliased | ||
LaravelLang\Locales\Data\LocaleData { | ||
+code: "de-DE" | ||
+type: "Latn" | ||
+name: "German" | ||
+native: "Deutsch" | ||
+regional: "de_DE" | ||
} | ||
``` | ||
|
||
## Using in production | ||
|
||
If you use access to facades and locales in production, then you also need to perform the following steps: | ||
|
||
```bash | ||
composer require laravel-lang/publisher --dev --quiet | ||
composer require laravel-lang/locales | ||
``` |
Oops, something went wrong.