I build a multilingual site. Initially, I store the content in the database and I give a UI in browser show that normal admin user can edit those data. Whenever admin adds any string in the database he/she can regenerate all those language files under app/lang/ under the corresponding file from admin panel by just pressing one button.
My table structure is
id | location | key |hindi | english |
---------------------------------------
1 | global | welcome |namaste | Welcome |
and use in view file like echo trans('global.welcome');
Now I want to automatically collect data from view file. Suppose I add echo trans('global.hello');
in my view file and it's not present in app/lang/en/global.php so fallback language will call. I want to track that situation so that I can add one row in the database table with hello as a key. I want to add to the database at development time, not in production.
- Is it good or any better option?
- How to fire my own function in fallback time?