Skip to content
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

Bump Publisher to version 15 #112

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
},
"require": {
"php": "^8.1",
"laravel-lang/attributes": "^2.4.1",
"laravel-lang/http-statuses": "^3.4.5",
"laravel-lang/lang": "^13.2.8",
"laravel-lang/locales": "^1.4",
"laravel-lang/publisher": "^14.7.1"
"laravel-lang/attributes": "^2.5.0",
"laravel-lang/http-statuses": "^3.5.0",
"laravel-lang/lang": "^13.3.0",
"laravel-lang/locales": "^1.5",
"laravel-lang/publisher": "^15.0"
},
"require-dev": {
"orchestra/testbench": "^8.14",
Expand All @@ -63,7 +63,7 @@
"prefer-stable": true,
"autoload-dev": {
"psr-4": {
"Tests\\": "tests"
"Tests\\": "tests/"
}
},
"config": {
Expand Down
35 changes: 27 additions & 8 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import dotenv from 'dotenv'

import { defaultTheme, viteBundler } from 'vuepress'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { containerPlugin } from '@vuepress/plugin-container'
import { githubLinkifyPlugin } from 'vuepress-plugin-github-linkify'
import {defaultTheme, viteBundler} from 'vuepress'
import {docsearchPlugin} from '@vuepress/plugin-docsearch'
import {containerPlugin} from '@vuepress/plugin-container'
import {githubLinkifyPlugin} from 'vuepress-plugin-github-linkify'

dotenv.config()

Expand All @@ -15,8 +15,8 @@ module.exports = {
description: 'Easily connect the necessary language packs to the application',

head: [
['link', { rel: 'icon', href: `https://${ hostname }/images/logo.svg` }],
['meta', { name: 'twitter:image', content: `https://${ hostname }/images/social-logo.png` }]
['link', {rel: 'icon', href: `https://${hostname}/images/logo.svg`}],
['meta', {name: 'twitter:image', content: `https://${hostname}/images/social-logo.png`}]
],

bundler: viteBundler(),
Expand All @@ -25,7 +25,7 @@ module.exports = {
hostname,
base: '/',

logo: `https://${ hostname }/images/logo.svg`,
logo: `https://${hostname}/images/logo.svg`,

repo: 'https://github.com/Laravel-Lang/common',
repoLabel: 'GitHub',
Expand Down Expand Up @@ -58,7 +58,26 @@ module.exports = {
text: 'Prologue',
collapsible: true,
children: [
'/installation/upgrade-guide/index.md',
{
text: 'Upgrade Guide',
children: [
{
text: 'Common',
children: [
'/installation/upgrade-guide/common/5.md',
]
},
{
text: 'Publisher',
children: [
'/installation/upgrade-guide/publisher/15.md',
]
},
'/installation/upgrade-guide/laravel-lang.md',
'/installation/upgrade-guide/caouecs.md',
]
},

'/installation/compatibility/support-policy.md',
'/installation/about.md'
]
Expand Down
1 change: 1 addition & 0 deletions docs/installation/compatibility/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ title: Attributes

| Laravel, Lumen | PHP | Publisher | Package Version | Status |
|----------------------|--------------------|-------------|-----------------|---------------------------------------|
| 10.x, 11.x | 8.1, 8.2 | 15.x | `^2.5` | ![Supported][badge_supported] |
| 8.x, 9.x, 10.x, 11.x | 8.1, 8.2 | 14.x | `^2.0` | ![Supported][badge_supported] |
| 7.x, 8.x, 9.x | 7.3, 7.4, 8.0, 8.1 | 12.1+, 13.x | `^1.0` | ![Not Supported][badge_not_supported] |

Expand Down
13 changes: 7 additions & 6 deletions docs/installation/compatibility/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ title: Common

# Compatibility: Common

| Laravel, Lumen | PHP | Package Version | What packages will be installed | Status |
|----------------|--------------------|-----------------|---------------------------------------------------------------------------|---------------------------------------|
| 10.x, 11.x | 8.1, 8.2 | `^4.0` | Publisher 14.x, Lang 13.x, Attributes 2.x, HTTP Statuses 3.x, Locales 1.x | ![Supported][badge_supported] |
| 8.x, 9.x, 10.x | 8.1, 8.2 | `^3.0` | Publisher 14.x, Lang 12.x, Attributes 2.x, HTTP Statuses 3.x | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 8.0, 8.1 | `^2.0` | Publisher 13.x, Lang 10.x, Attributes 1.x, HTTP Statuses 2.x | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 7.3, 7.4, 8.0, 8.1 | `^1.0` | Publisher 12.x, Lang 10.x, Attributes 1.x, HTTP Statuses 2.x | ![Not Supported][badge_not_supported] |
| Laravel, Lumen | PHP | Package Version | What packages will be installed | Status |
|----------------|--------------------|-----------------|------------------------------------------------------------------------------|---------------------------------------|
| 10.x, 11.x | 8.1, 8.2 | `^5.0` | Publisher 15.x, Lang 13.3+, Attributes 2.5+, HTTP Statuses 3.5+, Locales 1.x | ![Supported][badge_supported] |
| 10.x, 11.x | 8.1, 8.2 | `^4.0` | Publisher 14.x, Lang 13.x, Attributes 2.x, HTTP Statuses 3.x, Locales 1.x | ![Not Supported][badge_not_supported] |
| 8.x, 9.x, 10.x | 8.1, 8.2 | `^3.0` | Publisher 14.x, Lang 12.x, Attributes 2.x, HTTP Statuses 3.x | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 8.0, 8.1 | `^2.0` | Publisher 13.x, Lang 10.x, Attributes 1.x, HTTP Statuses 2.x | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 7.3, 7.4, 8.0, 8.1 | `^1.0` | Publisher 12.x, Lang 10.x, Attributes 1.x, HTTP Statuses 2.x | ![Not Supported][badge_not_supported] |

[badge_not_supported]: https://img.shields.io/badge/not%20supported-lightgrey?style=flat-square

Expand Down
1 change: 1 addition & 0 deletions docs/installation/compatibility/http-statuses.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ title: HTTP Statuses

| Laravel, Lumen | PHP | Publisher | Package Version | Status |
|----------------------|--------------------|-----------|-----------------|---------------------------------------|
| 10.x, 11.x | 8.1, 8.2 | 15.x | `^3.5` | ![Supported][badge_supported] |
| 8.x, 9.x, 10.x, 11.x | 8.1, 8.2 | 14.x | `^3.0` | ![Supported][badge_supported] |
| 7.x, 8.x, 9.x | 8.0, 8.1 | 13.x | `^2.0` | ![Not Supported][badge_not_supported] |
| 7.x, 8.x | 7.3, 7.4, 8.0, 8.1 | 10.x | `^1.0` | ![Not Supported][badge_not_supported] |
Expand Down
3 changes: 2 additions & 1 deletion docs/installation/compatibility/publisher.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ title: Publisher

| Laravel, Lumen | PHP | Package Version | Comment |
|------------------------------|-------------------------|-----------------|---------------------------------------|
| 8.x, 9.x, 10.x, 11.x | 8.1, 8.2 | `^14.0` | ![Supported][badge_supported] |
| 10.x, 11.x | 8.1, 8.2 | `^15.0` | ![Supported][badge_supported] |
| 8.x, 9.x, 10.x, 11.x | 8.1, 8.2 | `^14.0` | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 8.0, 8.1 | `^13.0` | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 7.3, 7.4, 8.0, 8.1 | `^12.0` | ![Not Supported][badge_not_supported] |
| 7.x, 8.x, 9.x | 7.3, 7.4, 8.0, 8.1 | `^11.2` | ![Not Supported][badge_not_supported] |
Expand Down
23 changes: 23 additions & 0 deletions docs/installation/upgrade-guide/caouecs.md
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
```
36 changes: 36 additions & 0 deletions docs/installation/upgrade-guide/common/5.md
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
```
51 changes: 0 additions & 51 deletions docs/installation/upgrade-guide/index.md

This file was deleted.

25 changes: 25 additions & 0 deletions docs/installation/upgrade-guide/laravel-lang.md
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! 🙂
111 changes: 111 additions & 0 deletions docs/installation/upgrade-guide/publisher/15.md
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
```
Loading