- 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
Next, publish locale files before generating CRUD. Publish locale files by running following command.
php artisan infyom:publish --localized
Above command will publish the following locale files into
NOTE: Default locale files will be published for english language.
|- resources |- lang |- en |- auth.php |- crud.php |- message.php
- This file contain language lines for login, registration, forgot-password, reset-password, emails and etc..
- This file contain 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.
If you have already published layout without localization option, then To get it worked with localization, you need to overwrite your normal files with localized files, for that you need to run the following command.
php artisan infyom.publish:layout --localized
This command will overwrite app, sidebar, login, register, menu and other blade files with localized files.
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.
|- resources |- 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 lang 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
resources\lang\. and copy all files from
resources\lang\en\directory and paste into
- Copy all files from
- Change all English values of all the keys to Spanish values.