11# Facades
22
3- Perhaps the facades will be useful to you:
3+ ## With DTOs
44
55``` php
6- use LaravelLang\Locales\Facades\Locales ;
6+ use LaravelLang\Locales\Data\Locale as LocaleData ;
77use LaravelLang\Locales\Enums\Locale;
8+ use LaravelLang\Locales\Facades\Locales;
89
910// List of available localizations.
10- Locales::available(): array
11+ Locales::available(): array // array< LocaleData >
1112
1213// List of installed localizations.
13- Locales::installed(): array
14+ Locales::installed(): array // array< LocaleData >
1415
1516// List of uninstalled localizations.
16- Locales::notInstalled(): array
17+ Locales::notInstalled(): array // array< LocaleData >
1718
1819// Retrieving a list of protected locales.
19- Locales::protects(): array
20+ Locales::protects(): array // array< LocaleData >
2021
2122// Check if language packs are available in requested locale.
2223Locales::isAvailable(Locale|string|null $locale): bool
@@ -28,10 +29,67 @@ Locales::isInstalled(Locale|string|null $locale): bool
2829Locales::isProtected(Locale|string|null $locale): bool
2930
3031// Getting the default localization name.
31- Locales::getDefault(): string
32+ Locales::getDefault(): LocaleData
33+
34+ // Getting the fallback localization name.
35+ Locales::getFallback(): LocaleData
36+ ```
37+
38+ For example:
39+
40+ ``` php
41+ return Locales::getDefault();
42+
43+ LaravelLang\Locales\Data\Locale {
44+ +code: "de"
45+ +codeAlias: "de-DE"
46+ +type: "Latn"
47+ +name: "German"
48+ +native: "Deutsch"
49+ +regional: "de_DE"
50+ }
51+ ```
52+
53+ ## With Raw Data
54+
55+ ``` php
56+ use LaravelLang\Locales\Enums\Locale;
57+ use LaravelLang\Locales\Facades\Locales;
58+
59+ // List of available localizations.
60+ Locales::raw()->available(): array // array<string >
61+
62+ // List of installed localizations.
63+ Locales::raw()->installed(): array // array<string >
64+
65+ // List of uninstalled localizations.
66+ Locales::raw()->notInstalled(): array // array<string >
67+
68+ // Retrieving a list of protected locales.
69+ Locales::raw()->protects(): array // array<string >
70+
71+ // Check if language packs are available in requested locale.
72+ Locales::raw()->isAvailable(Locale|string|null $locale): bool
73+
74+ // Check if a language pack is installed.
75+ Locales::raw()->isInstalled(Locale|string|null $locale): bool
76+
77+ // The checked locale protecting.
78+ Locales::raw()->isProtected(Locale|string|null $locale): bool
79+
80+ // Getting the default localization name.
81+ Locales::raw()->getDefault(): string
3282
3383// Getting the fallback localization name.
34- Locales::getFallback(): string
84+ Locales::raw()->getFallback(): string
85+ ```
86+
87+ For example:
88+
89+ ``` php
90+ return Locales::raw()->getDefault();
91+
92+ // de-DE
3593```
3694
3795To use this functionality, make sure you have
0 commit comments