I am implementing language files for my PHP application. I am using constants to define each word that I want to have translation for. I put a folder in the root of my application with files like en.php, fr.php, de.php, it.php etc. The translations are for form elements and error messages to display in their respective language. The language can be selected by clicking on a flag on top of the page.
What I’m not sure about is if the language file that holds all the defined words should be a single file or broken down into many, so I can load just what I need for each page. My app is getting quite large and it seems like a bad idea to load a giant PHP file.
Having single files located in a single location makes loading them simple but I’m not sure if this is the way to do it.
Thank you!
Well my suggestion would be use the divide and conquer approach obviously if you can achieve such a modularity that you are including only page/request specific language files than it would improve the response time