diff --git a/composer.json b/composer.json index 271689e53..2f2054ac6 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "laravel-lang/http-statuses": "^3.5.0", "laravel-lang/lang": "^13.3.0", "laravel-lang/locales": "^1.6", - "laravel-lang/native-locale-names": "^1.1", + "laravel-lang/native-locale-names": "^1.2", "laravel-lang/publisher": "^15.0" }, "require-dev": { diff --git a/docs/installation/upgrade-guide/publisher/15.md b/docs/installation/upgrade-guide/publisher/15.md index b25df3f7e..06f574e17 100644 --- a/docs/installation/upgrade-guide/publisher/15.md +++ b/docs/installation/upgrade-guide/publisher/15.md @@ -56,47 +56,57 @@ Also [changed](../../../usage/aliases.md) `aliases` section in the configuration ### Before ```php -LaravelLang\Publisher\Facades\Helpers\Locales::available(); // array +use LaravelLang\Publisher\Facades\Helpers\Locales; + +return Locales::available(); // array // ['en', 'fr', 'de', ...] -LaravelLang\Publisher\Facades\Helpers\Locales::getDefault(); // string +return Locales::getDefault(); // string // de-DE ``` ### After ```php -LaravelLang\Locales\Facades\Locales::available(); // array +use LaravelLang\Publisher\Facades\Helpers\Locales; + +return Locales::available(); // array // [, , ...] -LaravelLang\Locales\Facades\Locales::getDefault(); // LocaleData +return Locales::getDefault(); // LocaleData // -LaravelLang\Locales\Facades\Locales::raw()->available(); // array +return Locales::raw()->available(); // array // ['en', 'fr', 'de', ...] -LaravelLang\Locales\Facades\Locales::raw()->getDefault(); // string +return Locales::raw()->getDefault(); // string // de-DE ``` `` is a DTO class of `LocaleData`: ```php +use LaravelLang\Locales\Data\LocaleData; + +app()->setLocale('vi'); + // Non aliased -LaravelLang\Locales\Data\LocaleData { +LocaleData { +code: "de" +type: "Latn" +name: "German" +native: "Deutsch" + +localized: "Tiếng Đức" +regional: "de_DE" } // Aliased -LaravelLang\Locales\Data\LocaleData { +LocaleData { +code: "de-DE" +type: "Latn" +name: "German" +native: "Deutsch" + +localized: "Tiếng Đức" +regional: "de_DE" } ``` diff --git a/docs/usage/features/facades.md b/docs/usage/features/facades.md index 747493c49..dd73add23 100644 --- a/docs/usage/features/facades.md +++ b/docs/usage/features/facades.md @@ -39,46 +39,65 @@ Locales::getFallback(): LocaleData For example: ```php +use LaravelLang\Locales\Data\LocaleData; +use LaravelLang\Locales\Facades\Locales; + +// config('app.locale') // de + return Locales::getDefault(); // Non aliased -LaravelLang\Locales\Data\LocaleData { +LocaleData { +code: "de" +type: "Latn" +name: "German" +native: "Deutsch" + +localized: "Deutsch" +regional: "de_DE" } // Aliased -LaravelLang\Locales\Data\LocaleData { +LocaleData { +code: "de-DE" +type: "Latn" +name: "German" +native: "Deutsch" + +localized: "Deutsch" +regional: "de_DE" } ``` ```php +use LaravelLang\Locales\Data\LocaleData; +use LaravelLang\Locales\Facades\Locales; + +// config('app.locale') // vi + return Locales::get('de'); -LaravelLang\Locales\Data\LocaleData { +LocaleData { +code: "de" +type: "Latn" +name: "German" +native: "Deutsch" + +localized: "Tiếng Đức" +regional: "de_DE" } ``` ```php +use LaravelLang\Locales\Data\LocaleData; +use LaravelLang\Locales\Facades\Locales; + +// config('app.locale') // de + return Locales::get('foo'); // Will return the default locale -LaravelLang\Locales\Data\LocaleData { +LocaleData { +code: "de" +type: "Latn" +name: "German" +native: "Deutsch" + +localized: "Deutsch" +regional: "de_DE" } ```