Skip to content

Commit f356b4d

Browse files
committed
readme for aliases
1 parent c3b5fd5 commit f356b4d

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

README.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,59 @@ composer require coderello/laravel-nova-lang
1212

1313
## Usage
1414
### Publish Command
15-
Publish translations for one language:
15+
* Publish translations for one language:
1616
```bash
1717
php artisan nova-lang:publish de
1818
```
1919

20-
Publish translations for multiple languages:
20+
* Publish translations for multiple languages (comma-separated):
2121
```bash
2222
php artisan nova-lang:publish de,ru
2323
```
2424

25-
Publish translations for all languages:
25+
* Publish translations for all available languages:
2626
```bash
2727
php artisan nova-lang:publish --all
2828
```
2929

30-
Publish translations and override existing files:
30+
* Publish translations and override existing files:
3131
```bash
3232
php artisan nova-lang:publish de,ru --force
3333
```
3434

35+
#### Aliases
36+
The language codes chosen for the files in this repository may not match the preferences for your project. You can use the `--alias` option to publish locales using a different filename.
37+
38+
* Publish translations for one language with an alias, using the simple format `{alias}`:
39+
```bash
40+
php artisan nova-lang:publish de --alias=de-DE
41+
```
42+
This will publish the file `de-DE.json`.
43+
44+
45+
* Publish translations for multiple languages with multiple aliases, using the format `{locale}:{alias}` (comma-separated):
46+
```bash
47+
php artisan nova-lang:publish de,ru,fr --alias=de:de-DE,ru:ru-RU
48+
```
49+
This will publish the files `de-DE.json`, `ru-RU.json` and `fr.json` (no alias).
50+
51+
* Aliases can also be used with the `--all` flag:
52+
53+
```bash
54+
php artisan nova-lang:publish --all --alias=es:es-ES
55+
```
56+
You do not need to supply an alias for every locale that is to be published, only those that you wish to override.
57+
58+
* There are also some predefined option flags (case-sensitive) for common use cases:
59+
| Option | Explanation | Affected Languages | When Enabled | Default |
60+
| --- | --- | --- | --- | --- |
61+
| `‑‑zhHan` | Use Chinese scripts instead of regions. | Chinese (Simplified)<br>Chinese (Traditional) | `zh‑Hans`<br>`zh‑Hant` | `zh‑CN`<br>`zh‑TW` |
62+
| `‑‑ptBR` | Prefer Brazilian Portuguese as default. | Portuguese (Brazil)<br>Portuguese (Portugal) | `pt`<br>`pt‑PT` | `pt‑BR`<br>`pt` |
63+
| `‑‑srLatn` | Prefer Serbian in Latin script as default. | Serbian (Cyrillic)<br>Serbian (Latin) | `sr‑Cyrl`<br>`sr` | `sr`<br>`sr‑Latn` |
64+
| `‑U` or `‑‑underscore` | Use underscore separator instead of hyphen. | _(any)_ | _e.g._ `zh_CN` | _e.g._ `zh‑CN` |
65+
66+
These can all be used alone or in combination with each other and the `--alias` option.
67+
3568
### Development Commands (debug mode only)
3669

3770
You must have the `app.debug` config option set to true for these commands to be available:
@@ -42,12 +75,12 @@ This command is to assist contributors to find any untranslated keys for their c
4275

4376
A stub JSON file will be created at `storage_path('app/nova-lang/missing/{locale}.json')`. You can copy those keys into the `resources/lang/{locale}.json` language file in your own fork of the repository, translate them and create a pull request.
4477

45-
Output missing translation keys for one or more languages:
78+
* Output missing translation keys for one or more languages:
4679
```bash
4780
php artisan nova-lang:missing de,ru
4881
```
4982

50-
Output missing translation keys for all languages:
83+
* Output missing translation keys for all languages:
5184
```bash
5285
php artisan nova-lang:missing --all
5386
```
@@ -58,7 +91,7 @@ This command is to assist maintainers to update the completeness of each languag
5891

5992
A `README.excerpt.md` and `contributors.json` file will be created at `storage_path('app/nova-lang')`. You can copy those files into your own fork of the repository and create a pull request.
6093

61-
Output list of languages, lines translated and contributors:
94+
* Output list of languages, lines translated and contributors:
6295
```bash
6396
php artisan nova-lang:stats
6497
```

0 commit comments

Comments
 (0)