To 15 from 14 | Laravel Lang

Laravel Lang Help

To 15 from 14

Updating Dependencies

You should update the following dependency in your application's composer.json file:

  • laravel-lang/publisher to ^15.0

Run the update dependency console command:

composer update

Rename config file

Rename the configuration file:

mv config/lang-publisher.php config/localization.php

New constants namespace

Replace the locales namespace:




For example:

// 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 (see enumerations section).

Also changed aliases section in the configuration file.

New facade helper


use LaravelLang\Publisher\Facades\Helpers\Locales; return Locales::available(); // array<string> // ['en', 'fr', 'de', ...] return Locales::getDefault(); // string // de-DE


use LaravelLang\Publisher\Facades\Helpers\Locales; return Locales::available(); // array<LocaleData> // [<object>, <object>, ...] return Locales::getDefault(); // LocaleData // <object> return Locales::raw()->available(); // array<string> // ['en', 'fr', 'de', ...] return Locales::raw()->getDefault(); // string // de-DE
use LaravelLang\Locales\Data\LocaleData; app()->setLocale('vi'); // Non aliased LocaleData { +code: "de" +type: "Latn" +name: "German" +native: "Deutsch" +localized: "Tiếng Đức" +regional: "de_DE" } // Aliased LocaleData { +code: "de-DE" +type: "Latn" +name: "German" +native: "Deutsch" +localized: "Tiếng Đức" +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:

composer require laravel-lang/publisher --dev --quiet composer require laravel-lang/locales

If you do not use locales in production, then just move laravel-lang/publisher to the require-dev section and run the composer update command, or simply run the following console command:

composer require laravel-lang/publisher --dev --quiet
Last modified: 18 December 2023