Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
luisprmat committed Sep 13, 2021
1 parent b6b9b86 commit 65af63b
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ composer require luisprmat/laravel-lang-installer --dev

## Usage

After install a new laravel application with `Laravel >= 5.5` the package autodiscover system will register the new command `lang:add`.
### Add new language
After install a new laravel application with `Laravel >= 5.5` the package autodiscover system will register the new command `lang:add` and you can call with

This command can take a unique argument (or none) that will be the short name of the language according to **ISO 15897**.
```bash
php artisan lang:add <locale>
```
where `<locale>` refers to the short name of any of the [supported languages](README.md#supported-languages)
> ### *Warnings*
> - **Add lang** action overwrites the language files so that you already had custom translations you could lose them.
> - When adding a language this package first consults the `composer.json` file to copy only the translations of the supported packages that are installed ([Laravel Breeze](https://laravel.com/docs/8.x/starter-kits#laravel-breeze), [Laravel Cashier](https://laravel.com/docs/8.x/billing), [Laravel Fortify](https://laravel.com/docs/8.x/fortify) and [Laravel Jetstream](https://jetstream.laravel.com/2.x/introduction.html) are supported) `resources/lang/<locale>.json`. So it is good that you first install the supported packages that you will use and then run the command `php artisan lang:add <locale>`
> - If this command does not receive arguments, the Spanish language [`es`] will be installed by default.
If this command does not receive arguments, the Spanish language [`es`] will be installed by default.
This command can take a unique argument (or none) that will be the short name of the language according to **ISO 15897**.

This command also modifies the key `locale` in the `config/app.php` file to set the default language as passed through the parameter.

Expand Down Expand Up @@ -63,7 +71,14 @@ php artisan lang:add pt_BR --no-default
php artisan lang:add ar --inline
```


## Supported languages
`af`, `ar`, `az`, `be`, `bg`, `bn`, `bs`, `ca`, `cs`, `cy`, `da`, `de`, `de_CH`
, `el`, `es`, `et`, `eu`, `fa`, `fi`, `fil`, `fr`, `gl`, `he`, `hi`, `hr`, `hu`,
`hy`, `id`, `is`, `it`, `ja`, `ka`, `kk`, `km`, `kn`, `ko`, `lt`, `lv`, `mk`, `
mn`, `mr`, `ms`, `nb`, `ne`, `nl`, `nn`, `oc`, `pl`, `ps`, `pt`, `pt_BR`, `ro`,
`ru`, `sc`, `si`, `sk`, `sl`, `sq`, `sr_Cyrl`, `sr_Latn`, `sr_Latn_ME`, `sv`, `s
w`, `tg`, `th`, `tk`, `tl`, `tr`, `ug`, `uk`, `ur`, `uz_Cyrl`, `uz_Latn`, `vi`,
`zh_CN`, `zh_HK`, `zh_TW`

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Expand All @@ -72,3 +87,8 @@ This package does not modify the translations, only copies them from [`laravel-l

## License
[MIT](LICENSE.md)

## Todo

- [ ] Allow merge translations instead of overwrite them.
- [ ] Add Command `lang:update` to update translations and detect new installed packages to update their translations.

0 comments on commit 65af63b

Please sign in to comment.