Skip to content

Commit f2e6317

Browse files
Updated docs
1 parent fc36c62 commit f2e6317

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

docs/usage/aliases.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
# Aliases
22

3-
If you want to name codes differently, such as `de-DE` instead of `de` or `de-CH` instead of `de_CH`, you can define aliases in
4-
the [`configuration file`](https://github.com/Laravel-Lang/publisher/blob/main/config/public.php).
3+
If you want to name codes differently, such as `de-DE` instead of `de` or `de-CH` instead of `de_CH`, you can define
4+
aliases in
5+
the [`configuration file`](https://github.com/Laravel-Lang/locales/blob/main/config/public.php).
56

67
After that, all adding, updating, and deleting actions will automatically use the specified aliases.
78

8-
For example, `config/lang-publisher.php` config file:
9+
For example, `config/localization.php` config file:
910

1011
```php
11-
<?php
12-
13-
use LaravelLang\Publisher\Constants\Locales;
12+
use LaravelLang\Locales\Enums\Locale;
1413

1514
return [
1615
'aliases' => [
17-
Locales::GERMAN->value => 'de-DE',
16+
Locale::German->value => 'de-DE',
1817

19-
Locales::GERMAN_SWITZERLAND->value => 'de-CH',
18+
Locale::GermanSwitzerland->value => 'de-CH',
2019
],
2120
];
2221
```
2322

23+
If the `config/localization.php` file already exists, then you can add the `aliases` key in it and specify the desired
24+
aliases using a data array.
25+
26+
After this, you can, for example, add new localizations by specifying both the main code and its alias:
27+
2428
```bash
2529
php artisan lang:add de de_CH
2630
```
2731

32+
Installed locales will use the specified aliases as folder names for PHP translations and file names for JSON
33+
translations:
34+
2835
```
2936
lang
3037
de-CH

docs/usage/features/facades.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,36 @@
33
Perhaps the facades will be useful to you:
44

55
```php
6-
use LaravelLang\Publisher\Facades\Helpers\Locales;
6+
use LaravelLang\Locales\Facades\Locales;
7+
use LaravelLang\Locales\Enums\Locale;
78

89
// List of available localizations.
910
Locales::available(): array
1011

1112
// List of installed localizations.
1213
Locales::installed(): array
1314

14-
// List of installed localizations without protected codes.
15-
Locales::installedWithoutProtects(): array
16-
1715
// List of uninstalled localizations.
1816
Locales::notInstalled(): array
1917

2018
// Retrieving a list of protected locales.
2119
Locales::protects(): array
2220

2321
// Check if language packs are available in requested locale.
24-
Locales::isAvailable(LocaleCode|string|null $locale): bool
22+
Locales::isAvailable(Locale|string|null $locale): bool
2523

2624
// Check if a language pack is installed.
27-
Locales::isInstalled(LocaleCode|string|null $locale): bool
25+
Locales::isInstalled(Locale|string|null $locale): bool
2826

2927
// The checked locale protecting.
30-
Locales::isProtected(LocaleCode|string|null $locale): bool
28+
Locales::isProtected(Locale|string|null $locale): bool
3129

3230
// Getting the default localization name.
3331
Locales::getDefault(): string
3432

3533
// Getting the fallback localization name.
3634
Locales::getFallback(): string
3735
```
36+
37+
To use this functionality, make sure you have
38+
the [laravel-lang/locales](../../installation/about.md#laravel-lang-locales) package installed.

0 commit comments

Comments
 (0)