- Change config file
- Publish locale files
- Publish locale layout files
- Generate your CRUD
- Support new Locales
To get started with localization you must need to change option
'options' => [ 'localized' => true, ],
Next, If you haven't publish locale files before generating CRUD. Publish locale files by running following command.
If you have any custom locales added to
lang/en/auth.php then it will be overwritten. so take a backup if need.
php artisan infyom:publish --localized
Above command will publish locale files into
resources\lang\ directory for various available languages.
NOTE: Default locale files will be published for english language.
|- lang |- en |- auth.php |- crud.php |- message.php
- This file contains language lines for login, registration, forgot-password, reset-password, emails etc..
- This file contains language lines for CRUD buttons like create, update, cancel, save, etc., and confirmation text.
- This file will contain CRUD operation messages text like success, model not found, retrieved, deleted and updated.
laravel-ui-adminlte, if you want to publish your layout files with localization support, run the following command,
php artisan ui adminlte-localized --auth
After completing the above changes, now we are ready to generate CRUD with localization by running the following command.
php artisan infyom:scaffold Post
Note: Where Post is ModelName
If localization is
enabled then this command will generate new locale files into
resources\en\models\ directory. File name will be plural of model name, e.g if model name is Post then it will generate posts.php.
|- lang |- en |- models |- posts.php
This file will contain Singular Model Name, Plural Model Name and Model Fields.
As mentioned above, Generator will only generate locale files for english for model names and fields. Now to support a new locales, you need to create those locale files manually in relevant language folder with same keys but with different values.
For e.g., If you want to support Spanish locale, then perform the following steps.
- Create new directory with name
lang\, and copy all files from
lang\en\directory and paste into
- Change all English values of all the keys to Spanish values, including,